0

Context:

My app has 5 activities:

  • SplashScreenActivity - starts service
  • MainActivity - selects Activity 1,2 or 3
  • Activity 1
  • Activity 2
  • Activity 3

Currently I create notification in onCreate method of the service, which display recent activity after touching, based on

  1. android How to open last activity when tapping notification
  2. Resume application and stack from notification
  3. How to open last activity from notification status bar?

Problem

setOngoing method Notification.Builder is annoying - is always here, independent if my app is in foreground or not. So I change to the setAutoCancel method, but works only for first use. Example:

I run my app - splashscreen activity (notification is shown) -> main activity -> select Activity 1 - minimize. Now click notification - brings Activity 1 (OK), but notification is dismissed and never shown.

Question

How to display notification, every time I minimize app?

user2120666
  • 579
  • 1
  • 4
  • 16

1 Answers1

2

Simple override onPause and put the notification logic there.

Eyosiyas
  • 1,422
  • 1
  • 9
  • 25