Android 在单击特定url时启动应用程序
在安卓手机上单击任何视频url时,我希望我的应用程序显示在弹出窗口中,弹出窗口会显示“你想使用、chrome或myApp播放链接吗?” 我希望这种情况只发生在特定的视频链接,如Youtube视频网址只。简而言之,我的应用程序只能作为特定视频链接的浏览器使用。 我应该如何做到这一点 调查。您可以使用它们来注册应用程序,以处理特定的文件类型或特定的url方案。Android 在单击特定url时启动应用程序,android,video,android-intent,browser,intentfilter,Android,Video,Android Intent,Browser,Intentfilter,在安卓手机上单击任何视频url时,我希望我的应用程序显示在弹出窗口中,弹出窗口会显示“你想使用、chrome或myApp播放链接吗?” 我希望这种情况只发生在特定的视频链接,如Youtube视频网址只。简而言之,我的应用程序只能作为特定视频链接的浏览器使用。 我应该如何做到这一点 调查。您可以使用它们来注册应用程序,以处理特定的文件类型或特定的url方案。 <activity android:name=".YourActivity"> <intent-filter>
<activity android:name=".YourActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="http" android:host="www.youtube.com" ></data>
</intent-filter>
</activity>
您可能还希望对https和mobile使用相同的方案,不要忘记;-)
<data android:host="www.youtube.com" android:scheme="http" />
<data android:host="www.youtube.com" android:scheme="https" />
<data android:host="m.youtube.com" android:scheme="http" />
<data android:host="m.youtube.com" android:scheme="https" />