2013-12-09 56 views
1

我一直在搜索最近2天的堡壘,但遺憾的是我沒有得到任何滿意的答案。 我的問題是,每當在Android設備中點擊Youtube網址時,它應該列出我的應用程序爲使用完成操作我已經嘗試了很多,但沒有得到它。 這是我試過的代碼。如何抓取YouTube網址並在我的應用中播放?

<intent-filter> 
    <category android:name="android.intent.category.BROWSABLE" /> 
    <category android:name="android.intent.category.DEFAULT" /> 

    <action android:name="android.intent.action.VIEW" /> 

    <data android:scheme="http://www.youtube.com/watch?v=" /> 
</intent-filter> 
+0

http://developer.android.com/guide/topics/manifest/data-element.html#scheme – EvZ

+0

我已經檢查了所有的事情,但沒有什麼工作給我。 –

+0

你有沒有檢查過這個http://stackoverflow.com/questions/1609573/intercepting-links-from-the-browser-to-open-my-android-app? – EvZ

回答

2

最後我得到了答案。希望這會幫助別人。

<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:host="*.youtube.com" 
       android:pathPrefix="/watch" 
       android:scheme="http" /> 
      <data 
       android:host="*.youtube.com" 
       android:pathPrefix="/watch" 
       android:scheme="https" /> 
</intent-filter> 
0
<intent-filter> 
<data android:host="www.youtube.com/watch?v=" android:scheme="http" ></data> 
<category android:name="android.intent.category.BROWSABLE" /> 
<category android:name="android.intent.category.DEFAULT" /> 
<action android:name="android.intent.action.VIEW" /> 
</intent-filter> 
+0

這沒有奏效。 –

+0

@Sridhar你把這段代碼放在 ...標記之間嗎? – Syn3sthete

+0

是的..但後來它不工作 –

相關問題