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:
Re4son 2019-02-27 20:34:33 +11:00
parent f491036658
commit 1014d0622e

View File

@ -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);