Keep in mind though, that any service that runs indefinitely will drain the hell out of the phone's battery.
---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ---------------------------------------------------------------------- On Thu, Dec 10, 2009 at 2:28 AM, Sean Hodges <[email protected]>wrote: > Sounds like what you want is a Service: > > "A service doesn't have a visual user interface, but rather runs in > the background for an indefinite period of time. For example, a > service might play background music as the user attends to other > matters, or it might fetch data over the network or calculate > something and provide the result to activities that need it. Each > service extends the Service base class." > (http://developer.android.com/guide/topics/fundamentals.html) > > There is a simple tutorial here: > http://minicompact.com/mobiletalk/?p=18, and a more in-depth one here: > http://developerlife.com/tutorials/?p=356 > > And the reference page: > http://developer.android.com/reference/android/app/Service.html > > > On Wed, Dec 9, 2009 at 12:19 AM, j0hns0n <[email protected]> wrote: > > Hello! I have a program successfully running to relate AudioManager > > and SensorManager. By safe life-cycle practice: > > > > @Override > > protected void onResume() > > { > > super.onResume(); > > sensorManager.registerListener(sensorListener, > > SensorManager.SENSOR_ORIENTATION, SensorManager.SENSOR_DELAY_FASTEST); > > } > > > > @Override > > protected void onStop() > > { > > sensorManager.unregisterListener(sensorListener); > > super.onStop(); > > } > > > > Just to keep it clean. > > > > My question is that I'm interested in moving this program out of the > > active part of the priority and keep it running in the background > > until the user gets back to the program to switch it off. > > > > I'm still very new to all the life-cycle things so I'm just studying > > away. I still haven't found what I need to find yet. > > > > Bonus (if it can be addressed): It will be really cool if I can leave > > an icon at the top bar to show it is running. :) > > > > Thanks in advance. > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Beginners" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-beginners%[email protected]> > > For more options, visit this group at > > http://groups.google.com/group/android-beginners?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-beginners%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en

