2016-05-31 5 views
1

デバイス上のすべてのURLに応答するアプリを作りたいと思います。ドキュメントはbelow-AndroidのすべてのURLに対応するインテントフィルタ?

<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="www.youtube.com" android:scheme="http" /> 
</intent-filter> 

などの具体的なスキームをどのように処理するかを言及しかし、どのように私は、特定のドメインまたはホストに属さない任意のURLを処理するためにインテントフィルタを定義していますか?出来ますか?

答えて

1

単にあなたが投稿したコードから以下の行を削除します。

<data android:host="www.youtube.com" android:scheme="http" /> 

ですから、あなただけの

<data android:scheme="http" /> 
にラインを短くしたい場合、

また
<intent-filter> 
    <action android:name="android.intent.action.VIEW" /> 
    <category android:name="android.intent.category.DEFAULT" /> 
    <category android:name="android.intent.category.BROWSABLE" /> 
</intent-filter> 

で終わるだろう

これは、あなたのアプリを傍受するだけのhttp URLなので、基本的にリンクします。

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:scheme="http"/> 
      <data android:scheme="https"/> 
      <data android:scheme="about"/> 
      <data android:scheme="javascript"/> 
     </intent-filter> 
のようなスキーマの定義
関連する問題