I'm trying to develop an application in which a login class is called whenever user switches to some other application or presses Home button.
For example, I have two activities Activity1 and Activity2.
- Activity2 is called from Activity1, so that mean Activity1 goes to onPause state.
- When user switches to some other application, Login class should be called from that activity and on successful authentication it resumes at the same point.
And Currently I'm starting an intent for Login class in every Activity's onPause method. So when I switch from Activity1 to Activity2, onPause method of Activity1 is getting executed and I'm not able to switch to Activity2.
To put it simple, Login class should be called only when user switches to some other application or presses Home button but not when the application is in foreground.
Hope you understand my problem. Thanks !