Skip to content

Commit

Permalink
#90 Add option to not pause on bluetooth disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
daneren2005 committed Oct 4, 2013
1 parent 2421212 commit 15a2868
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public void onReceive(Context context, Intent intent) {
Util.registerMediaButtonEventReceiver(context);
} else if (isDisconnected(intent)) {
Log.i(TAG, "Disconnected from Bluetooth A2DP, requesting pause.");
context.sendBroadcast(new Intent(DownloadServiceImpl.CMD_PAUSE));
SharedPreferences prefs = Util.getPreferences(context);
int pausePref = Integer.parseInt(prefs.getString(PREFERENCES_KEY_PAUSE_DISCONNECT, "0"));
if(pausePref == 0 || pausePref == 2) {
context.sendBroadcast(new Intent(DownloadServiceImpl.CMD_PAUSE));
}
}
}
private boolean isConnected(Intent intent) {
Expand Down Expand Up @@ -75,4 +79,4 @@ else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(intent.getAction())) {
}
return false;
}
}
}

0 comments on commit 15a2868

Please sign in to comment.