2013-06-02 29 views
0

當任何視頻網址被點擊時,在android手機上,我希望我的應用程序能夠在彈出窗口中顯示,也就是說,是否要使用,chrome或myApp播放鏈接。點擊特定網址啓動應用程序

我希望這隻發生在特定的視頻鏈接上,例如Youtube視頻網址。簡而言之,我的應用程序只能作爲瀏覽器用於特定的視頻鏈接。 我應該如何做到這一點。

+0

http://paragchauhan2010.blogspot.com/2013/03/make-鏈接功能於Android的瀏覽器的啓動up.html –

回答

1

調查Intent Filters。您可以使用它們來註冊您的應用程序來處理某些文件類型或特定的url方案。

1
<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和移動相同的方案,不要忘記它;-)

<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" /> 
相關問題