start activity from browser
Im trying to register a protocol in my app whereby a url executed in the android browser will launch my activity, all the examples Ive seen on the web say to add an Intent Filter on my activity such as
<activity android:name=".UrlActivity">
<intent-filter>
<action android:na开发者_运维技巧me="android.intent.action.View"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="myscheme" android:host="myhost"/>
</intent-filter>
</activity>`
but this doesnt seem to be enough to get the Android OS to launch my activity... Is there anyone who could tell me if there is something Im missing?
Thanks
Try removing theandroid:host
part, but retain the android:scheme
attribute.
Also check logcat for any errors or warnings.
The URL has to be made available as a hyperlink on a page for the user to tap. Entering the URL in a browser on your device will not work. This resolved the problem for me.
精彩评论