I wanted to know when my Application class' onCreate is called, whether it was created due to user opening the app or by itself due to some reason like broadcast received/job started etc. Please help.
Asked
Active
Viewed 44 times
0
-
Can you please know, how you want to know by notification or By Toas? – Dhaval Solanki Mar 01 '18 at 03:26
2 Answers
0
You can set boolean variable inside pref. Set this variable to true inside your broadcast/service.
And Inside onCreate method just check for that value. And also set it to false after using it in onCreate
M.Usman
- 1,891
- 19
- 24
0
Better approach would be to set a flag/tag from your service as described in below post. And in activity check is the flag/tag is available and perform necessary operations.
Gokul Nath KP
- 14,745
- 24
- 85
- 122