Custom extension file does not open in my application

I wanted a custom extension file (* .xyz) to be opened through my application. Inside the application manifest file, I write the following:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:scheme="http"    android:host="*" android:pathPattern=".*\\.xyz" />
        <data android:scheme="https"   android:host="*" android:pathPattern=".*\\.xyz" />
        <data android:scheme="content" android:host="*" android:pathPattern=".*\\.xyz" />
         <data android:scheme="file"   android:host="*" android:pathPattern=".*\\.xyz" />
</intent-filter>

After that, I will install my application on the device and send an email containing Sample.xyzmail as an attachment. When I try to open the application in the mail client to open the attachment, it will throw an error with the name

No app can open this attachment for viewing

Even if you download the application and then try to open it, it will give an error

Can't open file

Can anyone suggest what might be wrong?

+4
source share
1 answer

, http https - <intent-filter> - : https://github.com/ligi/PassAndroid/blob/master/src/main/AndroidManifest.xml , *.pkpass *.xyz, :

    <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:host="*"
            android:pathPattern=".*\\.xyz"
            android:scheme="http" />
    </intent-filter>
    <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:host="*"
            android:pathPattern=".*\\.xyz"
            android:scheme="https" />
    </intent-filter>
    <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:host="*"
            android:pathPattern=".*\\.xyz"
            android:scheme="file" />
    </intent-filter>
    <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:host="*"
            android:pathPattern=".*\\.xyz"
            android:scheme="content" />
    </intent-filter>
+2

Source: https://habr.com/ru/post/1540355/


All Articles