Commit e822ab20 authored by Lisa (AI Assistant)'s avatar Lisa (AI Assistant)

Add hardcoded gateway config for pairing test, update to SDK 36

parent 85bd8e7d
...@@ -7,12 +7,12 @@ plugins { ...@@ -7,12 +7,12 @@ plugins {
android { android {
namespace = "com.nexlab.openclaw.node" namespace = "com.nexlab.openclaw.node"
compileSdk = 35 compileSdk = 36
defaultConfig { defaultConfig {
applicationId = "com.nexlab.openclaw.node" applicationId = "com.nexlab.openclaw.node"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 36
versionCode = 1 versionCode = 1
versionName = "0.1.0" versionName = "0.1.0"
multiDexEnabled = true multiDexEnabled = true
......
...@@ -59,15 +59,27 @@ class NodeService : Service() { ...@@ -59,15 +59,27 @@ class NodeService : Service() {
createNotificationChannel() createNotificationChannel()
acquireWakeLock() acquireWakeLock()
// Auto-start with saved settings // Auto-start with saved settings OR hardcoded defaults
try { try {
val prefs = getSharedPreferences("openclaw_settings", MODE_PRIVATE) val prefs = getSharedPreferences("openclaw_settings", MODE_PRIVATE)
Log.e(TAG, "Reading SharedPreferences...") Log.e(TAG, "Reading SharedPreferences...")
val ip = prefs.getString("gateway_ip", "") ?: "" // Use SharedPreferences or fall back to hardcoded defaults
val port = prefs.getString("gateway_port", "18789") ?: "18789" var ip = prefs.getString("gateway_ip", "") ?: ""
val token = prefs.getString("node_token", "") ?: "" var port = prefs.getString("gateway_port", "18789") ?: "18789"
val protocol = prefs.getString("gateway_protocol", "WS") ?: "WS" var token = prefs.getString("node_token", "") ?: ""
val nodeId = prefs.getString("node_id", "") ?: "" var protocol = prefs.getString("gateway_protocol", "WS") ?: "WS"
var nodeId = prefs.getString("node_id", "") ?: ""
// TEMPORARY HARDCODED CONFIG FOR PAIRING TESTING
if (ip.isBlank()) {
Log.e(TAG, "Using hardcoded config for pairing test")
ip = "192.168.11.46"
port = "18789"
token = "415fa3c21b7ef06f22aff571697d88c59c2dc67737681267"
protocol = "WS"
nodeId = "android-node"
}
// END TEMPORARY CONFIG
Log.e(TAG, "Settings read: ip=$ip tokenLen=${token.length} port=$port") Log.e(TAG, "Settings read: ip=$ip tokenLen=${token.length} port=$port")
...@@ -96,11 +108,22 @@ class NodeService : Service() { ...@@ -96,11 +108,22 @@ class NodeService : Service() {
"START" -> { "START" -> {
startForeground(NOTIFICATION_ID, createNotification()) startForeground(NOTIFICATION_ID, createNotification())
// Get settings from Intent extras // Get settings from Intent extras
val protocol = intent.getStringExtra("gateway_protocol") ?: "WS" var protocol = intent.getStringExtra("gateway_protocol") ?: "WS"
val ip = intent.getStringExtra("gateway_ip") ?: "" var ip = intent.getStringExtra("gateway_ip") ?: ""
val port = intent.getStringExtra("gateway_port") ?: "18789" var port = intent.getStringExtra("gateway_port") ?: "18789"
val token = intent.getStringExtra("node_token") ?: "" var token = intent.getStringExtra("node_token") ?: ""
val nodeId = intent.getStringExtra("node_id") ?: "" var nodeId = intent.getStringExtra("node_id") ?: ""
// TEMPORARY HARDCODED CONFIG FOR PAIRING TESTING
if (ip.isBlank()) {
Log.e(TAG, "Using hardcoded config for pairing test")
ip = "192.168.11.46"
port = "18789"
token = "415fa3c21b7ef06f22aff571697d88c59c2dc67737681267"
protocol = "WS"
nodeId = "android-node"
}
// END TEMPORARY CONFIG
val fullUrl = if (protocol == "WSS") "wss://$ip:$port" else "ws://$ip:$port" val fullUrl = if (protocol == "WSS") "wss://$ip:$port" else "ws://$ip:$port"
System.out.println("=== NodeService STARTED with URL: $fullUrl ===") System.out.println("=== NodeService STARTED with URL: $fullUrl ===")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment