How to enable only one instance of my application

坚强是说给别人听的谎言 提交于 2019-11-29 13:01:02

问题


I need only one instance of my app in android. If I run my app after installation and go to Home screen, and again run my app (click on app's icon), second instance is opened, I need to open already running first instance not to run second instance. I don't know how to solve this.


回答1:


Use android:launchMode="singleTask" or android:launchMode="singleInstance" in your manifest.xml in your activity tag



来源:https://stackoverflow.com/questions/9467802/how-to-enable-only-one-instance-of-my-application

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