I have a custom file type/extension that I want to associate my app with.
As far as I know, the data element is made for this purpose, but I can\'t get it working. h
The answeres given by Phyrum Tea and yuku are very informative already.
I want to add that starting with Android 7.0 Nougat there is a change to the way file sharing between apps is handled:
From official Android 7.0 Changes:
For apps targeting Android 7.0, the Android framework enforces the StrictMode API policy that prohibits exposing file:// URIs outside your app. If an intent containing a file URI leaves your app, the app fails with a FileUriExposedException exception.
To share files between applications, you should send a content:// URI and grant a temporary access permission on the URI. The easiest way to grant this permission is by using the FileProvider class. For more information on permissions and sharing files, see Sharing Files.
If you have your own custom file ending without a specific mime-type (or i guess even with one) you may have to add a second scheme value to your intent-filter to make it work with FileProviders too.
Example:
The important thing here is the addition of
to the filter.
I had a hard time finding out about this little change which kept my activity from opening on Android 7.0 devices while everything was fine on older versions. I hope it helps someone.