0

I'm trying to open a specific url with my app instead of browser. I have it working correctly except if my app is already open, the url doesn't open to the page specified.

My manifest file is as follows:

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="myapp"/>
<data android:scheme="http"/>
</intent-filter>

And I'm getting the intent data as:

Intent intent = getIntent();
Uri data = intent.getData();

But getIntent() returns the intent that started my activity, what if my url click didn't start my activity and the activity had already been created, how do I get the intent for whatever is resuming the app (so my specific path link). Is that even possible???

I am targeting Android 4.2.2

Marcia H
  • 3
  • 3

1 Answers1

1

how do I get the intent for whatever is resuming the app (so my specific path link)

Override onNewIntent() and use the Intent passed into it.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I would add - make sure you have `android:launchMode="singleTop"` set for the activity in your `AndroidManifest.xml`, so this works more than just once. – Peter Dec 09 '22 at 00:22