Re: [android-developers] Implementing ScheduledExecutorService (or an alternative)
Using an AlarmManager,
kris
On Wed, Aug 29, 2012 at 11:49 PM, Jason Hsu <jhsu802701@gmail.com> wrote:
> What is the best way to make an Android app AUTOMATICALLY execute a series
> of certain commands periodically?
>
> I just published an app called the Battery Saver Flashlight. The source
> code is on GitHub at https://github.com/jhsu-android/BatterySaverFlashlight
> .
>
> This app has a settings page, and I want it to AUTOMATICALLY update the
> status of the WiFi, Bluetooth, and GPS functions (on or off). The Bluetooth
> status and the GPS status lag the action of clicking the Enable/Disable
> buttons and thus don't get updated. I tried to use ScheduledExecutorService
> to implement automatic status updating, but the app kept quitting on me.
> The messages in Eclipse said that I needed to use static functions to avoid
> a memory leak. Unfortunately, it looked like I'd have to make everything in
> the script a static function. So I decided to leave this feature out until
> I can get it to work properly. The user has to hit the back button (returns
> to the introduction page) and then click on the Continue button in order to
> update the status.
>
> What's the best way to make my app automatically execute a series of
> commands periodically?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home