2

Related to: Android Messaging, Email app behavior when starting app from a link

To be able to start my app from an SMS, and then upon hitting the Messaging icon, have Messaging go back to where it was before (at the message showing the link), I added this to the manifest:

<activity android:name=".SMSActivity" android:launchMode="singleTask" >

But now when I do this, my app starts up great the first time I click the link in the SMS. If I then go back to Messaging and click the same link, my app is started, but with a completely black screen.

It seems I can't have it both ways. Changing the launchMode to singleTop fixes this problem, but if I do that, then if I launch the app from the SMS, my app takes over the Messaging app. The Recent list shows only the Messaging app running my app. I can't go back to Messaging.

There must be a way to get this to work. I have tried many combinations of launch modes in the manifest, and intent flags when starting up SMSActivity. Currently I am just using default flags when starting SMSActivity. I am not adding any flags to the Intent.

Thanks

fbs419
  • 51
  • 5
  • I think the key here is implementing OnPause and OnResume to save some state. I believe that the second time the app is started, it would just go into OnResume and just do nothing. If no state has been saved, the app will not run correctly in this case. Have to be careful with Intent flags. But this is the crux of the issue. Should be able to get this working. – fbs419 Jul 01 '18 at 16:16

0 Answers0