Custom Filetype in Android not working

2019-01-28 02:36发布

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

1条回答
ら.Afraid
2楼-- · 2019-01-28 03:21

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>
查看更多
登录 后发表回答