Launch with intent
In Chapter 7, 360-Degree Gallery, we introduced the use of Android intents to associate an app with a specific file type in order to launch our app as a viewer of those files. We'll do the same for OBJ files here.
An intent is a message that any app can send to the Android system that declares its intent to use another app for a certain purpose. The intent object contains a number of members to describe what type of action needs to be done, and, if any, the data on which it needs to be done. For the image gallery, we associated the intent filter with an image mime type. For this project, we'll associate an intent filter with a filename extension.
In your AndroidManifest.xml
file, add an intent filter to the activity block. This lets Android know that the app can be used as an OBJ file viewer. We need to specify it as a file scheme and the filename pattern. The wildcard mime type and host are also required by Android. Add the following XML code:
<...