Kaydet (Commit) 36bb1a31 authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

Fix some serviceconnection issues and more bluetooth power managment.

Change-Id: Id2e309ee5b8f6feff845dba28e7474e2246865f5
üst 08de755c
......@@ -83,9 +83,13 @@ public class PairingActivity extends SherlockActivity {
@Override
public void onReceive(Context aContext, Intent aIntent) {
if (mCommunicationService == null) {
return;
}
if (aIntent.getAction().equals(
CommunicationService.MSG_PAIRING_STARTED)) {
String aPin = aIntent.getStringExtra("PIN");
mPinText.setText(aPin);
// refreshLists();
} else if (aIntent.getAction().equals(
......
......@@ -41,6 +41,7 @@ public class StartPresentationActivity extends SherlockActivity {
@Override
protected void onDestroy() {
super.onDestroy();
unbindService(mConnection);
LocalBroadcastManager.getInstance(this).unregisterReceiver(mListener);
}
......
......@@ -29,11 +29,12 @@ public class BluetoothClient extends Client {
private BluetoothAdapter mAdapter;
public BluetoothClient(Server aServer,
CommunicationService aCommunicationService) {
CommunicationService aCommunicationService,
boolean aBluetoothWasEnabled) {
super(aServer, aCommunicationService);
try {
mAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothWasEnabled = mAdapter.isEnabled();
mBluetoothWasEnabled = aBluetoothWasEnabled;
if (!mBluetoothWasEnabled) {
mAdapter.enable();
}
......
......@@ -89,7 +89,8 @@ public class CommunicationService extends Service implements Runnable {
mClient = new NetworkClient(mServerDesired, this);
break;
case BLUETOOTH:
mClient = new BluetoothClient(mServerDesired, this);
mClient = new BluetoothClient(mServerDesired, this,
mBluetoothPreviouslyEnabled);
break;
}
mTransmitter = new Transmitter(mClient);
......
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