0

I have a network call in my activitiy's onResume that I only want the user to call after coming back to the app from another app, a long period of inactivity, or from the Android app stack.

I don't want it to be called when it resumes from calling finish() on a second Activity on top of the first Activity.

What would be the best way to do this?

DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83
  • 1
    A boolean can do the trick or you can use `onRestart()` as calling point . But u said you Only want it call if user is coming back from other app . That means your whole app was in stopped state before . I don't know about any new Solution for this but i did Used [ProcessLifeCycleOwner](https://stackoverflow.com/a/48767617/4168607) for same purpose few times. – ADM Feb 15 '23 at 05:10

0 Answers0