Hi,
I believe I have figured things out correctly, but I would appreciate
input of others to avoid breaking things.
I'm hoping to setup my app to be able to download files such as
Gingerbread.wltheme.zip from any website and be handled with my app.
However I do not want my app to be used for normal Zip files as it's
only meant to handle these special wltheme type of zip files. I'd like
to use the .wltheme.zip filename as it makes it easy on webservers to
send the mime type correctly and it makes it easy for users to extract
the files and manually edit them. (Renaming files on Windows is a lot
more difficult than it should be).
On Gingerbread I can get away with:
<activity android:name=".UserThemeInstaller"
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/zip"
android:scheme="file"
android:host="*"
android:pathPattern=".*\\.wltheme\\.zip" />
</intent-filter>
</activity>
As the Download app will let you download a zip file and then when
opening from there lets my app handle it.
However for Android 2.1/2.2 it seems the file won't even download
without a generic handler for application/zip, so the above only works
if the user also has Astro or similar installed. I found that this
seems to work:
<activity android:name=".UserThemeInstaller"
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/zip"
android:scheme="file"
android:host="*"
android:pathPattern=".*\\.wltheme\\.zip" />
</intent-filter>
<intent-filter android:priority="-100" >
<action android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="application/zip"
android:scheme="file" />
</intent-filter>
</activity>
Where if the user only has my app installed then they download
a .wltheme.zip and it is allowed because of the handler for
application/zip. This also doesn't annoy the user much as if they
download a normal .zip and do have Astro or similar it won't try to
get them to open it with my app as the priority for the generic zip is
very low.
Worst case is if they user only has my app and downloads a normal zip,
then my app will try to handle it and present an error message. This
seems acceptable.
My question is, am I doing this correctly or is it likely to break
something?
Thanks,
-Kevin
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en