How to enable only one instance of my application
Asked Answered
G

1

15

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.

Gantz answered 27/2, 2012 at 15:43 Comment(0)
K
25

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

Keystroke answered 27/2, 2012 at 15:47 Comment(3)
What is difference of singleTask and singleInstance?Teepee
Take a look: #3220226Keystroke
@Zapnologica It is too late but on your Launcher activity.Mayonnaise

© 2022 - 2024 — McMap. All rights reserved.