Skip to content

Commit

Permalink
do not startForegroundService() if persistNotifications is false
Browse files Browse the repository at this point in the history
  • Loading branch information
eighthave committed Oct 28, 2019
1 parent 4d0a834 commit 2a5eec5
Showing 1 changed file with 5 additions and 6 deletions.
Expand Up @@ -21,13 +21,12 @@ public void onReceive(Context context, Intent intent) {
if (Prefs.allowBackgroundStarts()) {
Intent startTorIntent = new Intent(context, TorService.class);
startTorIntent.setAction(action);
if (packageName != null)
startTorIntent.putExtra(EXTRA_PACKAGE_NAME, packageName);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(startTorIntent);
if (packageName != null) {
startTorIntent.putExtra(TorService.EXTRA_PACKAGE_NAME, packageName);
}
else
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Prefs.persistNotifications()) {
context.startForegroundService(startTorIntent);
} else {
context.startService(startTorIntent);
}
} else if (!TextUtils.isEmpty(packageName)) {
Expand Down

0 comments on commit 2a5eec5

Please sign in to comment.