Android Question How to open existing app when user click notification message

ThePuiu

Active Member
Licensed User
Longtime User
Hi, in my app, user can receive Firebase notification.
I would like when a notification is received and the application is minimized, if user click on notification, to show the existing instance and do not open a new one ... Is it possible?
Thank you!
 

DonManfred

Expert
Licensed User
Longtime User
If the app was killed in the meantime then you´ll start a new instance for sure.
If the app was paused but running then the app will be started and run through activity_create for sure (but Firsttime is false). In fact Android will resume your app in the activity which is defined in the notification... If you defined Main there then mainactivity will be started.
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
the application starts with a login screen. Once the authentication is done, it goes to the main screen. I want when click on the notification to open the main page not the login page, but only if the user is logged in (the application is in the main screen), otherwise open the login page. Any idea?
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
How do you show login or main screen?
Are they panels? Different activities?
 
Upvote 0

ThePuiu

Active Member
Licensed User
Longtime User
different activities (close "Login" and StartActivity("Main") if credentials are correct)
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
And how do you open Login or Main when open the app normally (without notification).

I think you should handle this from starter service.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…