Skip to content

Commit 082c4cd

Browse files
committed
Revert removal of if statment to check what state is received
1 parent 490fe10 commit 082c4cd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,18 @@ public void onListObtained(boolean successful) {
118118

119119
}
120120

121-
121+
if (intent.getAction().contains("android.bluetooth.adapter.action.STATE_CHANGED")){
122+
int state = intent.getIntExtra("android.bluetooth.adapter.extra.STATE",-1);
123+
if (state == BluetoothAdapter.STATE_OFF ||
124+
state == BluetoothAdapter.STATE_TURNING_OFF){
125+
//onProtocolDisabled(context);
126+
//Let's let the service that is running manage what to do for this
127+
//If we were to do it here, for every instance of this BR it would send
128+
//an intent to stop service, where it's only one that is needed.
129+
return;
130+
}
131+
}
132+
122133
if(localRouterClass!=null){ //If there is a supplied router service lets run some logic regarding starting one
123134

124135
if(!didStart){

0 commit comments

Comments
 (0)