I'm having trouble opening an XML from the "Google Files App" file to do internal processing in my app, despite using an intent filter in the manifest file.
Here's what I've done:
- I use an XML file named data.xml in the Download directory of my app.
- I added the following intent filter to the from my MainActivity element in my app's manifest file:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:exported="true"
android:theme="@style/AppTheme.NoActionBar">
<!-- Main -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Register XML -->
<intent-filter>
<action android:name="android.intent.action.OPEN_DOCUMENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/xml" />
</intent-filter>
</activity>
Here are some things I've tried:
- I made sure that the XML file is well-formed.
- I made sure that the intent filter is correct.
- I tried using different MIME types.
Nothing has worked so far. I'm working on an app with SDK 33.
Replace
android.intent.action.OPEN_DOCUMENTwithandroid.intent.action.VIEW.