Preventing main activity from being launched if running already

十年热恋 提交于 2019-12-05 09:03:37

You need to set the Activity's launchMode to singleTask. You can do this by adding the activity attribute in your Android Manifest:

android:launchMode="singleTask"

See the documentation for more details.

Use flags when asking the user to start the application. Set the flag when this is first enabled and each time check if this flag is ticked. For example if (flag == 1) askusertostart() else continue; if this is clear to you?

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