[android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-21 Thread Kenneth WON
The purpose of this app is to run the service forever until shutdown the phone, and after the user leaves the app and return later, the service will not launch again, means only have one of this service running. Now, the problem is it can't only have one of this service running. Do I need adding

Re: [android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-21 Thread Mark Murphy
Kenneth WON wrote: The purpose of this app is to run the service forever until shutdown the phone, and after the user leaves the app and return later, the service will not launch again, means only have one of this service running. Please don't do that. First, it's not possible:

[android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-20 Thread Kenneth WON
Hi, thank you for your help! But I tried to add android:launchMode=singleTask or android:launchMode=singleInstance in the activity before, but it seems not work. The app still running twice or more at the same time by rotate screen or press return button, and launch the app. On Apr 21, 4:38 am, ~

Re: [android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-20 Thread Dianne Hackborn
Make sure you aren't calling startActivity() anywhere, such as in onCreate(). Look at the log (adb logcat) and event log (adb logcat -b events) to see what the system is saying about launching and handling activities. Please don't use singleTask or singleInstance to fix such problems, they are

[android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-20 Thread Kenneth WON
Hi, Dianne Hackborn, Thank you! In the main activity, I will start a service, so I am calling startService() in onCreate(). Is that not necessary? On Apr 21, 11:25 am, Dianne Hackborn hack...@android.com wrote: Make sure you aren't calling startActivity() anywhere, such as in onCreate().

Re: [android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-20 Thread Dianne Hackborn
Starting a service doesn't have anything to do with the activity stack. It is only needed if you actually must have a service running even after the user leaves your app. (And of course you must have a good plan for how you will stop the service, so it doesn't get left running forever.) On Tue,

[android-developers] Re: How to solve the problem of launch the apps twice or more?

2010-04-20 Thread Nithin
I also face the same problem, what I did was in manifest, inside activity, just included android:launchMode=singleTop and its working fine. What singleTop will do is, The standard and singleTop modes differ from each other in just one respect: Every time there's new intent for a standard