Custom Filetype in Android not working
Asked Answered
M

1

5

I'm currently writing an Android App and it should open Files with the ending .meetme

Actually it should open them directly from Gmail, but I don't think that is possible.

This is the Code of my AndroidManifest.xml:

<activity android:name=".MeetingRequest" android:label="Meeting Request">
    <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="file" />
        <data android:mimeType="*/*" />
        <data android:host="*" />
        <data android:pathPattern=".*\\.meetme" />
    </intent-filter>
</activity>

I've tried quite a few variations, if I open the file in Astro wit h a long click and open as text, my app shows up and can open it normally. Would be grateful for any help.

Markus

Misplay answered 12/1, 2011 at 23:32 Comment(3)
What are you trying to do with the file? read its raw data or display it to a user?Joaquinajoash
@user551380: First, you have not asked a question. Second, Android works much better based on MIME types than file extensions.Dyanne
Hey, I'm reading the raw data, that part works. My question was how to associate the filetype ".meetme" with my activity, because this version here does not work. Thanks for your comments.Misplay
C
5

After a lot of trial and error and reading nearly everything I could find, here's what finally worked for me:

    <activity android:name=".DrawActivity"
              android:screenOrientation="portrait"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW"/>
            <action android:name="android.intent.action.EDIT"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:pathPattern="*.snowdragon"/>
            <data android:mimeType="text/snowdragon"/>
        </intent-filter>
    </activity>
Clearheaded answered 13/1, 2011 at 17:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.