1

Is it possible to have a notification pop up when app is closed.

This is my current code, it works only when the app is open or in the backstack of apps.

Intent intent = new Intent(this, AlarmReceiver.class);
intent.putExtra("NotificationText", "some text");
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, ledgerId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, 'X seconds in milliseconds', pendingIntent);
netcross
  • 105
  • 1
  • 7
  • try this link...[link](https://stackoverflow.com/questions/12758681/android-how-can-i-put-my-notification-on-top-of-notification-area) – Sanjay Ravichandran Jun 17 '20 at 00:10
  • use Notification manager on a service class as services can continue running as the app is closed – Code Demon Jun 17 '20 at 06:07
  • see https://stackoverflow.com/questions/40440710/background-service-using-alarm-manager and https://stackoverflow.com/a/35106689/8461344 – Code Demon Jun 17 '20 at 06:14

0 Answers0