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 {
android {
namespace = "com.nexlab.openclaw.node"
compileSdk = 35
compileSdk = 36
defaultConfig {
applicationId = "com.nexlab.openclaw.node"
minSdk = 26
targetSdk = 35
targetSdk = 36
versionCode = 1
versionName = "0.1.0"
multiDexEnabled = true
......
......@@ -59,15 +59,27 @@ class NodeService : Service() {
createNotificationChannel()
acquireWakeLock()
// Auto-start with saved settings
// Auto-start with saved settings OR hardcoded defaults
try {
val prefs = getSharedPreferences("openclaw_settings", MODE_PRIVATE)
Log.e(TAG, "Reading SharedPreferences...")
val ip = prefs.getString("gateway_ip", "") ?: ""
val port = prefs.getString("gateway_port", "18789") ?: "18789"
val token = prefs.getString("node_token", "") ?: ""
val protocol = prefs.getString("gateway_protocol", "WS") ?: "WS"
val nodeId = prefs.getString("node_id", "") ?: ""
// Use SharedPreferences or fall back to hardcoded defaults
var ip = prefs.getString("gateway_ip", "") ?: ""
var port = prefs.getString("gateway_port", "18789") ?: "18789"
var token = prefs.getString("node_token", "") ?: ""
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")
......@@ -96,11 +108,22 @@ class NodeService : Service() {
"START" -> {
startForeground(NOTIFICATION_ID, createNotification())
// Get settings from Intent extras
val protocol = intent.getStringExtra("gateway_protocol") ?: "WS"
val ip = intent.getStringExtra("gateway_ip") ?: ""
val port = intent.getStringExtra("gateway_port") ?: "18789"
val token = intent.getStringExtra("node_token") ?: ""
val nodeId = intent.getStringExtra("node_id") ?: ""
var protocol = intent.getStringExtra("gateway_protocol") ?: "WS"
var ip = intent.getStringExtra("gateway_ip") ?: ""
var port = intent.getStringExtra("gateway_port") ?: "18789"
var token = intent.getStringExtra("node_token") ?: ""
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"
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