I have an activity with an intent filter for ACTION_SEND. A file can be shared to this activity from another app , let's say Gallery, and handled in onNewIntent.
However, on my Samsung Galaxy S5 it's not working as it used to (it's been tested on numerous devices and still works on some, so I think it's device specific). onCreate is always being called and onNewIntent is not. It always had a launchMode of singleTask.
When I background the app and come back, onCreate is not called, but when I select my app from a chooser in order to share a file to it, I get the behaviour described above.
I've tried setting the launchMode to singleTop and setting the flags intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); on the intent that initially launches the activity. I've tried setting Intent.FLAG_ACTIVITY_SINGLE_TOP on its own. I've also tried changing the launchMode to singleInstance. savedInstanceState seems to be null when I return to the activity too even though onSaveInstanceState was called when app was backgrounded.
Is there any way to prevent this behaviour and call onNewIntent or is it a device-specific bug?