Events:
1.USB device plugged in.
- Prompt appears saying: "Open appName when this USB device is connected?"
- Press cancel -> app stays open | press okay -> app restarts
Required behaviour: The app either does not show the dialog and automatically opens the app when it's not in the foreground, or, when the app is in the foreground then when the user presses okay the app does not restart.
Attempted solution: I've tried making sure every Activity's launch mode is set to "SingleTask"
. This solution worked here but when I did the same thing the app still restarted.
Question in a nutshell: How do I stop my app restarting when the user says to open the app when the device is connected? Or, how do I stop this prompt entirely whilst still enabling my app to start when this USB device is connected?
I've seen similar questions which deal with stopping a prompt showing which asks whether the app should be allowed to access the connected device, but, my issue is dealing with a different prompt.
Thanks in advance.