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 <johnson.tec...@gmail.com> 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 android-beginners@googlegroups.com
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> 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 android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to