sandalone
sandalone

Reputation: 41749

How to detect from which app a user returned to your app?

A user presses on a URL in my app and the URL opens in the mobile browser.

Is it possible that I detect in my app when a user returned from the mobile browser to my app?

Many users will simply read the content of URL and press back to return to my app.

Test case:

  1. user clicks on URL
  2. mobile browser opens the URL
  3. user touches BACK button
  4. app detects that user came back to the app from the mobile browser

If I did not explain this well, please let me know.

Upvotes: 1

Views: 228

Answers (1)

jimmithy
jimmithy

Reputation: 6380

I would suggest that you launch the URL with startActivityForResult. Then, when the user returns to your application onActivityResult will be called, and if the RequestCodes align you know it is the web browser.

For more information, take a look at this: http://developer.android.com/reference/android/app/Activity.html#StartingActivities

Upvotes: 3

Related Questions