I've implemented a custom URL scheme on Android and iOS, with the idea that we will send an "activation" email to the user, who clicks a link which spawns the native app.
Technically, we send an HTML formatted email with a link such as:
<a href="myapp://activate/accountId/uniquetoken">Click to activate</a>
On iOS it works fine, but on Android, it doesn't work.
I've seen a few other S.O posts and similar things that android itself should handle the custom URL scheme, but indicate it is the Chrome browser and the GMail for Android app which is stripping these custom myapp://
url's out.
As per the advice of some of those posts, I've tried creating an intent url. I've tried all of the following
intent://activate#Intent;scheme=myapp;package=com.mycompany.myapp;end
#Intent;action=activate;end
#Intent;component=com.mycompany.myapp/.ui.MainActivity;end
intent://#Intent;component=com.mycompany.myapp/.ui.MainActivity;end
but none of them worked. None were clickable from within the GMail for android app on Android 6, and the android documenation on the format for intent uri's is incredibly poorly documented. The best I can find is "programmatically create your intent in Java, then call .toUri on it", (which is how I produced most of the broken intent uri's above)
Any help would be much appreciated
Update 1. Here's my activity and intents from the Android manifest
<activity android:name=".ui.MainActivity" android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- load via URL scheme -->
<intent-filter>
<data android:scheme="myapp" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I've tried setting up a web server, which "reflects" back to the custom app scheme, and this DOES work for both Android and iOS
<a href="http://mycloudserver.net/myapp/activate/accountId/uniqueToken">Click</a>
That page does a 302 redirect to
myapp://activate/accountId/uniqueToken
The web browser (Chrome for android) follows this redirect, which causes the native app to launch, so that does provide a solution (of sorts) for the Gmail for android app.
It introduces an artificial dependency on a cloud server though, which would be nice to avoid.
On iOS it leaves behind an empty page in the Safari browser too, which is minor but unfortunate.
myapp://activate/accountId/uniqueToken
, you may need to include the full path in your Intent, or at least far enough in the path that theintent-filter
in yourAndroidManifest.xml
can identify it. Could you paste yourAndroidManifest.xml
'sintent-filter
that handles the url scheme?