From 955c030c0f122bdb5d9227528feee49a449fe96e Mon Sep 17 00:00:00 2001 From: James Cotton Date: Tue, 2 Oct 2012 23:36:49 -0500 Subject: [PATCH] Android Telemetry: Start the service explicitly before binding. This ensures it continues running while the tablet rotates or changes activities. --- .../src/org/openpilot/androidgcs/ObjectManagerActivity.java | 1 + .../org/openpilot/androidgcs/telemetry/BluetoothUAVTalk.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/androidgcs/src/org/openpilot/androidgcs/ObjectManagerActivity.java b/androidgcs/src/org/openpilot/androidgcs/ObjectManagerActivity.java index 8cd89e8d8..42915413b 100644 --- a/androidgcs/src/org/openpilot/androidgcs/ObjectManagerActivity.java +++ b/androidgcs/src/org/openpilot/androidgcs/ObjectManagerActivity.java @@ -256,6 +256,7 @@ public abstract class ObjectManagerActivity extends Activity { // Bind to the telemetry service (which will start it) Intent intent = new Intent(getApplicationContext(), org.openpilot.androidgcs.telemetry.OPTelemetryService.class); + startService(intent); if (DEBUG) Log.d(TAG, "Attempting to bind: " + intent); bindService(intent, mConnection, Context.BIND_AUTO_CREATE); diff --git a/androidgcs/src/org/openpilot/androidgcs/telemetry/BluetoothUAVTalk.java b/androidgcs/src/org/openpilot/androidgcs/telemetry/BluetoothUAVTalk.java index 5c1028cb3..257f94145 100644 --- a/androidgcs/src/org/openpilot/androidgcs/telemetry/BluetoothUAVTalk.java +++ b/androidgcs/src/org/openpilot/androidgcs/telemetry/BluetoothUAVTalk.java @@ -143,7 +143,7 @@ public class BluetoothUAVTalk extends TelemetryTask { socket = null; try { - socket = device.createInsecureRfcommSocketToServiceRecord(MY_UUID); + socket = device.createRfcommSocketToServiceRecord(MY_UUID); } catch (IOException e) { if (ERROR) Log.e(TAG,"Unable to create Rfcomm socket"); return false;