0

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.

2 Answers2

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
  • 2,049
  • 22
  • 25
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.

How to get data from service to activity

Gokul Nath KP
  • 15,485
  • 24
  • 88
  • 126