Restart NotificationManager on exit if required
Closing the application on Android Nougat and older causes a null pointer exception so we check if the NotificatiionManager Service exists and start it if it doesn't
This commit is contained in:
parent
f491036658
commit
1014d0622e
@ -152,6 +152,9 @@ public class TermService extends Service implements TermSession.FinishCallback
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
// invoking notificationManager.cancel on Android < 8 causes a null pointer exception so we should check first
|
||||
if (notificationManager == null)
|
||||
notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
// Remove notification
|
||||
notificationManager.cancel(notifyID);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user