I cannot download (from web & from e-mail) unkwown extentions such as (*.ini, *.zip, *.ddd) unless there exists an app that can under开发者_如何学运维stand the extention.
For example, I couldn't download *.ini file from the browser (or email) until I downloaded 'Astro' app.
- How can you by pass so that they are downloadable?
- How can you register your app to understan certain extention so that it can be downloadable?
How can you by pass so that they are downloadable?
You don't.
How can you register your app to understan certain extention so that it can be downloadable?
Ideally, you don't. You do it by MIME type. File extensions are very fragile. However, either can be achieved via the use of the <data>
element in your activity's <intent-filter>
. You will also want the BROWSEABLE
category and probably the VIEW
action.
For example, here is how you would arrange to be an option for viewing PDF files:
<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="application/pdf" />
</intent-filter>
<activity
android:name=".Main"
android:label="@string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="file" />
<data
android:pathPattern=".*\\.ini" />
<data
android:host="*" />
</intent-filter>
</activity>
Above code allowed me to download *.ini files. Thank you for your help.
精彩评论