私のアプリケーションを使ってカスタム拡張機能を使ってファイルを開く必要があります。私はファイルが私のSDカードにあるときにインテントフィルターを使用してこれを行うことができます。ファイルがGmailの添付ファイルとして送信されている場合は、[ダウンロード]と[プレビュー]ボタンも表示されます。しかし、ダウンロード/プレビューボタンをクリックすると、メッセージが届きました。"申し訳ありませんが、添付ファイルをダウンロードできませんでした"。Android - 自分のアプリケーションでGmail添付ファイルを開く
私はこれが私のアプリの問題だと思っていました。しかし、私はランダムなアイデアを持っていて、私の電話に "Download All Files"アプリをインストールしました。 https://play.google.com/store/apps/details?id=com.hwkrbbt.downloadall&hl=en 次に、Gmailでダウンロードボタンをクリックすると、ファイルをダウンロードするための[すべてのファイルをダウンロード]と[私のアプリケーション]の両方が表示されます。私は私のアプリを選んだ、そしてすべてがうまくいく!!
これはセキュリティ上の問題ですか? これらは私のインテントフィルタです:
<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:mimeType="*/*" />
<data android:scheme="content" android:host="*"
android:pathPattern=".*\\.ate" />
<data android:scheme="file" android:host="*"
android:pathPattern=".*\\.ate" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" host="*" android:pathPattern=".*.ate" android:scheme="content" />
</intent-filter>
編集:ここでは完全な活性タグです。
<activity android:name=".TestApp"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.TestApp.TestApp.NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- Opening .ate file start -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.ate" />
</intent-filter>
<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:mimeType="*/*" />
<data android:scheme="content" android:host="*"
android:pathPattern=".*\\.ate" />
<data android:scheme="file" android:host="*"
android:pathPattern=".*\\.ate" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="file" android:pathPattern=".*\\.ate" android:mimeType="application/octet-stream"/>
<data android:scheme="content" android:pathPattern=".*\\.ate" android:mimeType="application/octet-stream"/>
</intent-filter>
<!-- Opening .ate file end -->
</activity>
は、あなたが試してみました**アンドロイドMIMEタイプのアプリケーションで、両方のコンテンツおよびファイル・スキームの種類が必要ですか? –