Android Question clicking notification induce app pause?

le_toubib

Active Member
Licensed User
Longtime User
hi
i have a Main module + a service that occasionally sends notifications (using the BARX notification builder).
in the service the notification.setactivity is set to (Main)
now assuming the main module is currently shown , when the user click on the notification icon , :
1-is that normally supposed to trigger : activity_pause -->starter_service --> activity_create --> activity_resume events (in that order?)???
i.e: relaunch the app after user clicked the notification although its still running ???
2-how to prevent that ?
3-will the starter_service be relaunched also ? if not then i d have to re_initialize all views?
4- how to detect if the Main module is currently shown or not?
thanks
and offcourse sorry for the newbie qs
 

DonManfred

Expert
Licensed User
Longtime User
i.e: relaunch the app after user clicked the notification although its still running ???
yes, that´s normal.
2-how to prevent that ?
You cant
3-will the starter_service be relaunched also ?
due to your post you said it IS started....
4- how to detect if the Main module is currently shown or not?
B4X:
if isPaused(Main) then
  ' do something
else
  ' main ist already visible
end if
 
Upvote 0

le_toubib

Active Member
Licensed User
Longtime User
is it possible to trap the event of clicking on the notification , to do some action in the currently open module , instead of reloading the whole thing ?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
is it possible to trap the event of clicking on the notification
You cannot trap the event as there is NO event which is raised. The Notification will start the given Activity. What you do in starting the activity or need to do depends on your needs.

You can for sure create an transparent activity which will be called to receive the notification click. But then the transparent act is called. and this activity must give the value to another activity from yor app. So in fact ANOTHER activity will be called (incl all which is defined in the activity lifetimecycles. Activity_creat, activity_resume and so on..
Learn to life with that or dont use Notifications.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…