tags:

views:

100

answers:

3

Hi folks, I need to guarantee that my Android application won't be launched twice. How to do it? I mean in ideal I would need in case of second launch just switch to primary copy.

+1  A: 

According to the Android activity lifecycle, it shouldn't be possible to start a second copy on an activity. If it isn't terminated, it will resume the running instance.

Andrew Koester
You can most definitely have multiple "copies" of activities running. The lifecycle chart has nothing to do with this
Falmarri
Andrew: I know that I have managed to launch several copies of my application... How you can explain it?
barmaley
+2  A: 

Consider using android:launchMode More on that here

Asahi
A: 

That is the normal behavior of app launching. You don't need to do anything special. (And definitely do not at all use the android:launchMode="singleInstance" option. That is a very special behavior that is probably not what you want.)

hackbod