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 something in AndroidManifest.xml file, the class that
extends Activity class or the class that extends Service class?


On Apr 21, 1:07 pm, Dianne Hackborn <[email protected]> wrote:
> 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, Apr 20, 2010 at 9:05 PM, Kenneth WON <[email protected]> wrote:
> > 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 <[email protected]> wrote:
> > > 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
> > > not needed and have other repercussions you probably don't want.
>
> > > On Tue, Apr 20, 2010 at 7:07 PM, Kenneth WON <[email protected]>
> > wrote:
> > > > 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, "~ TreKing" <[email protected]> wrote:
> > > > > On Tue, Apr 20, 2010 at 2:06 AM, Kenneth WON <[email protected]>
> > > > wrote:
> > > > > > But my expected result is just have one and only one app A launch.
>
> >http://developer.android.com/intl/fr/guide/topics/manifest/activity-e...
> > > > > <
> >http://developer.android.com/intl/fr/guide/topics/manifest/activity-e..
> > > > .>
>
> > ---------------------------------------------------------------------------
> > > > ----------------------
> > > > > TreKing - Chicago transit tracking app for Android-powered
> > deviceshttp://
> > > > sites.google.com/site/rezmobileapps/treking
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to
> > [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<android-developers%2Bunsubs
> > > > >  [email protected]><android-developers%2Bunsubs
> > [email protected]>
> > > > > For more options, visit this group athttp://
> > > > groups.google.com/group/android-developers?hl=en
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<android-developers%2Bunsubs
> > > >  [email protected]><android-developers%2Bunsubs
> > [email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > [email protected]
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support, and so won't reply to such e-mails.  All such
> > > questions should be posted on public forums, where I and others can see
> > and
> > > answer them.
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%2Bunsubs
> > >  [email protected]>
> > > For more options, visit this group athttp://
> > groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs 
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to