I would like to recover the android intent my activity is launched with.
My activity, tested in API 19 (KitKat), besides the main intent, has the following intent filter and parameters:
android:alwaysRetainTaskState="false"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize">
<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:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.svg" />
<data android:host="*" />
</intent-filter>
But when I open a SVG file while the activity was running, it does not handle the new intent. I tried the following combinations, launched the activity,
android:launchMode="singleTask"
android:launchMode="standard"
android:launchMode="singleTop"
combined with the following parameter, that makes 6 configurations
android:finishOnTaskLaunch="true" or "false"
But none of them make the onNewIntent
function to be called when I open a SVG with my application. Instead, it displays the previous state (onPause and onResume are called as expected, and onCreate is called instead).
The only workaround I found was to cal the finish()
function from withing the onPause()
method, so that it effectively terminates the application. I don't understand what is going on because it was working last year before I changed targets.
What is the required configuration to access the calling intents each time?
Related questions without answers to mine:
- This blog explains that I should use "singleTop" but it is not working in my case.
- This SO question does not have any answer.
- This famous SO question describes the set-up of the intent. But in my case, I do not create the intent myself, android does.