Skip to content

Commit

Permalink
fix: Added startForeground to onCreate (#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 authored Aug 10, 2021
1 parent 32db43d commit 353880a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,21 @@ public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
return START_NOT_STICKY;
}

@Override
public void onCreate() {
super.onCreate();
String channel = Utils.getNotificationChannel((Context) this);
startForeground(1, new NotificationCompat.Builder(this, channel).build());
}


@Override
public void onDestroy() {
super.onDestroy();

destroy();
stopForeground(true);
}

@Override
Expand Down

0 comments on commit 353880a

Please sign in to comment.