Android Messaging, Email app behavior when starting app from a link

你说的曾经没有我的故事 提交于 2019-12-24 18:51:36

问题


I am working on the capability of starting an app via an SMS link or an email. It is all working fine. Custom links don't parse on Android phones, but that is another story. My http style link works great. But the issue is the behavior of apps like Messaging, Android GMail App, Android Mail app, Android Outlook app, Whatsapp, etc. ( Here is the scenario:

  1. Go to app, like Messaging, Gmail, etc.
  2. Click on the link to start up my app (app starts up correctly)
  3. Hit the Home Button
  4. Hit the icon of the app that I used to start up my own app

On Samsung phones, when I do step 4 (above), the Messaging and Outlook apps show my app, not the message or email list. The Gmail and Android Email apps behave correctly (in my opinion). These apps bring you back to where you were in that app. On my LG phone, the Messaging app behaves correctly. Whatsapp always seems to behave badly.

My main concern are messaging apps, as I want to use SMS as a way to start up my app. I think that the Messaging app should go back to the message list like my LG phone.

Is there a solution to this? Thanks


回答1:


So the answer in this case is to add android:launchMode="singleTask" to the activity attribute in the manifest. Then all Messaging, Outlook, Mail, and Gmail apps all behave correctly.

Now have to figure out how to prevent the user from trying to open this app multiple times.



来源:https://stackoverflow.com/questions/51087229/android-messaging-email-app-behavior-when-starting-app-from-a-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!