2017-03-29 7 views
1

私のアプリケーションを使用してカスタムファイルタイプ(.mia)を開きたいとします。私はこの方法を試しましたカスタムファイルがアンドロイドで開きます

 <activity android:name=".MainActivity"> 
      <intent-filter android:icon="@mipmap/ic_launcher"> 
       <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" android:host="*" 
        android:pathPattern=".*\\.mia" 
        android:mimeType="*/*"/> 
       <data android:scheme="https" android:host="*" 
        android:pathPattern=".*\\.mia" 
        android:mimeType="*/*"/> 
       <data android:scheme="content" android:host="*" 
        android:pathPattern=".*\\.mia" 
        android:mimeType="*/*"/> 
       <data android:scheme="file" android:host="*" 
        android:pathPattern=".*\\.mia" 
        android:mimeType="*/*"/> 
      </intent-filter> 
     </activity> 

それはマシュマロとゼリーの豆で完璧に動作します。しかし、ロリポップでは、通知バーからダウンロードファイルをクリックすると開いていません。しかし、私が任意のファイルマネージャから開くと動作します。通知バーでユーザーがダウンロードファイルをクリックしたときにアプリを表示するにはどうすればよいですか?

+0

あなたがどのような解決策を考え出すのですか?私は今、同じものが不思議です... –

答えて

0

は、各data要素に別々のintent-filterを使用してみてください:

<activity android:name=".MainActivity"> 
    <intent-filter android:icon="@mipmap/ic_launcher"> 
     <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" android:host="*" 
      android:pathPattern=".*\\.mia" 
      android:mimeType="*/*"/> 
    </intent-filter> 
    <intent-filter android:icon="@mipmap/ic_launcher"> 
     <action android:name="android.intent.action.VIEW" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
     <category android:name="android.intent.category.BROWSABLE" /> 
     <data android:scheme="https" android:host="*" 
      android:pathPattern=".*\\.mia" 
      android:mimeType="*/*"/> 
    </intent-filter> 
    ... 
    ... 
</activity> 
関連する問題