I've created an app that opens when clicking a specific URL. Obviously I've got something like this:
<intent-filter>
<data android:scheme="http" android:host="example.com"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
So that's all great, whenever somebody clicks a link with http://example.com/whatever/stuff... it'll open my app. However, within my app, after doing some stuff, I want to send the suer back to the default browser (or whichever browser/web view they were using when they clicked the link to begin with). My problem is that I end up creating a loop:
- User clicks link http://example.com/xxx and my app opens.
- My app does stuff, and now wants to send the user to a different URL, eg. http://example.com/yyy
The intent that my app sends, ends up just going back to itself (my app).
Intent httpIntent = new Intent(Intent.ACTION_VIEW); String theNewURL = http://example.com/yyy; httpIntent.setData(Uri.parse(theNewURL)); startActivity(httpIntent);
How can I get my httpIntent
to use the default browser (or wherever the user came from to begin with) instead of calling my app again?
Edit: I've been able to solve the problem in a make-shift way, by making a CNAME record of one of my own domains (as a sort of alias) that goes to the same spot as http://example.com. It sucks because the user now sees a different URL, but it still works in that it doesn't invoke the intent. (Am I even using the right language when I talk about intents?)