0

I have my android app, that downloads a file via the DownloadService. This file is in special file format, that only can be used in my app - it has the suffix *.foobar.

I start the download this way:

DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDestinationInExternalPublicDir("/", "aaaa.foobar");

// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);

Download works fine, but when I tap on the notification "download finished", I want that my activity will be opened. What I get is the toast "File can not be opened".

In my Manifest I have a intent-filter for the .foobar file suffix.

    <intent-filter android:label="@string/app_name">
        <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:pathPattern=".*\\.foobar" />
        <data android:host="*" />
    </intent-filter>

Am I missing something?

appsthatmatter
  • 6,347
  • 3
  • 36
  • 40

2 Answers2

2

finally found the solution!

I had to remove the path pattern line

                <data android:pathPattern=".*\\.foobar" />

and change the schema to content. So the complete intent filter is:

<intent-filter android:label="@string/app_name">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="content" />
                <data android:mimeType="application/wcmap" />
                <data android:host="*" />
            </intent-filter>
appsthatmatter
  • 6,347
  • 3
  • 36
  • 40
1

I think you will find the answer to this answer. Most likely you have a problem in the treatment of Activiti or slightly incorrect description of intent.

Try adding a priority.

android:priority="integer"

Also you should look:

Good luck. Sorry that can not help more. Too much text for a comment.

Community
  • 1
  • 1
user2413972
  • 1,355
  • 2
  • 9
  • 25