lundi 11 mai 2015

Android register app for file type

I'm developing an app to read gpx files and than save them in it's database. For this I need to register my app for .gpx files, but for some reason it is not working.

After many research I figured out that I have to put an intent-filter onto my activity, but it still won't work.

<activity
    android:name=".RequestSharedFilesActivity"
    android:label="@string/title_activity_request_shared_files" >
    <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:mimeType="application/octet-stream"
            android:host="*"
            android:pathPattern=".*\\.gpx"
            />
    </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:mimeType="application/gpx"
            android:host="*"
            android:pathPattern=".*\\.gpx"
            />
    </intent-filter>
</activity>

And before you ask, yes I have added the permission to read and write on the external storage.

Maybe someone of you could help me. Thanks!

Aucun commentaire:

Enregistrer un commentaire