I have a url that I am overriding in my Android App. Clicking a link from an email to that link pops up the Intent Chooser
dialog ("Complete this using"). However clicking the same link (in an <a>
tag) from within Chrome (on Android 4) redirects me to that url, and doesn't offer the Intent Chooser
.
If I replace the link in the <a>
tag with a link to the Google Play Store (https://play.google.com
) then clicking the link pops up the Intent Chooser
again.
Is there something special with the Google Play Store and Chrome, or have I done something wrong configuring my url? Is there something I can do in html to make this work?
Here's the <intent-filter>
<activity
android:label="@string/app_name"
android:name="..."
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<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:scheme="https"
android:host="www.example.com"
/>
<data android:scheme="http"
android:host="www.example.com"
/>
</intent-filter>
</activity>
(Redirecting to the url also does not pop up the Intent Chooser
dialog, but I figured my situation above more pointedly expresses my issue.)
Also of note, I am fairly certain this was all working while my domain was down. As soon as my domain came online this stopped working. This could be a figment of my imagination as I wasn't 100% focused on this problem at the time.
Is it possible that Chrome treats Google Play Store urls special, otherwise it waits for a non-200 response from a url before opening the Intent Chooser
?
I tinkered with this quite a bit and it may be easier to just show you a method that works. This works on a device with 2.3.4 and a device with 4.2.2, so I'm thinking it will work on most devices.
Here's my intent filter from the manifest file:
<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:scheme="http" android:host="realsimpleapps.com" android:pathPrefix="/acv/" />
</intent-filter>
Here's my html file:
<a href="http://realsimpleapps.com/acv/aThing">Click Me!</a>
And in my Main activity I use this to grab whatever I have "aThing" (above) set to:
Uri data = getIntent().getData();
if (data != null) {
List<String> params = data.getPathSegments();
if (params != null) {
Log.d(tag, "Param 0: " + params.get(0));
}
}
Get that working, then add the second data element to the intent filter. If it still works after that, you should be set.
Let us know how it goes.
db
Could very well be a real/known bug.
The one I suggested (but which is now closed so it seems would be fixed for version you're trying with): https://code.google.com/p/chromium/issues/detail?id=113140
Found/opened by @xbakesk: https://code.google.com/p/chromium/issues/detail?id=170925 https://code.google.com/p/chromium/issues/detail?id=230104
If any other bugs found, just let me know in the comments and I will add, or edit my answer directly. If bugs get closed, I'll also try to update the answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With