Using startForeground() will be injustice to device just for the sake of sending location update. And with use of startForeground(), device may never go to sleep. So be cautious while keeping awake CPU for no reason. As mentioned earlier AlarmManger is of good use for this purpose.
-Amit On Apr 6, 12:15 pm, Dianne Hackborn <[email protected]> wrote: > If you want to have your service always running, you can use > Service.startForeground(). This does require that you post a notification > along with it, so the user is aware of your app running. > > > > > > On Tue, Apr 5, 2011 at 11:00 PM, Mahavir Jain <[email protected]> wrote: > > Yes.. I am thinking of that approach only.. > > > Thanks to all. > > > Mahavir > > > On Tue, Apr 5, 2011 at 10:05 PM, Nick Kulikaev <[email protected]>wrote: > > >> Did you consider a bit different approach and use alarm manager to wake up > >> your app "after regular interval"? If you only need to send device > >> location to the server this should work just fine. > > >> -- > >> 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 > > > -- > > 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 > > -- > 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.- Hide quoted text - > > - Show quoted text - -- 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

