Wow, you're so good! But still didn't answer the question in the first
place!

In one of my app I'm able to do that because I registered an alarm, so
I can check if the app was killed and re-register to that event!
In my other app, depending on settings I don't want to keep an alarm
triggering just for that purpose, consuming more CPU.

So now the question is: What other solutions is there to make sure to
receive the SCREEN_ON event!

I'm already using USER_PRESENT event, but it gets triggered all the
time, whereas depending on settigs I just don't need to receive either
events!

Thanks again your highness!

On 13 juil, 04:31, Justin Anderson <magouyaw...@gmail.com> wrote:
> As a side note, the link I posted before was the very first result of doing
> a Google search for "android SCREEN_ON."  You probably would have been able
> to solve this issue much faster if you had taken the time to do some simple
> research before posting the question and then having to wait for someone to
> answer...
>
> Thanks,
> Justin Anderson
> MagouyaWare Developerhttp://sites.google.com/site/magouyaware
>
> On Tue, Jul 12, 2011 at 8:16 PM, Justin Anderson <magouyaw...@gmail.com>wrote:
>
> >http://stackoverflow.com/questions/2575242/android-intent-action-scre...
>
> > Thanks,
> > Justin Anderson
> > MagouyaWare Developer
> >http://sites.google.com/site/magouyaware
>
> > On Sat, Jul 2, 2011 at 12:03 AM, 3c <ccouno...@gmail.com> wrote:
>
> >> Hello,
>
> >> I have an application which monitors various components of the Android
> >> system: CPU, Memory, SD, apps, etc...
>
> >> The users can select to have a widget or a notification displayed on
> >> their device or even both. The notifications are able to display CPU
> >> load or CPU frequency and are provided as additional APK receiving
> >> intents from the main app (background service + broadcastreceiver with
> >> scheduled alarms).
>
> >> So, my app registers to receive SCREEN_ON and SCREEN_OFF broadcasts
> >> to  disable widget/notification refreshes when screen is off. So
> >> during screen off, the app is actually not doing anything at all, but
> >> only waiting for the SCREEN_ON intent to restart refreshing widgets/
> >> notifications!
>
> >> The problem is that for some users, after an overnight in standby, the
> >> widgets and notifications do not refresh anymore!
>
> >> I suspect it's because the app was killed and the SCREEN_ON
> >> registration is lost?
>
> >> So I tried to have the app killed when screen goes off... Well on my
> >> device at least it works as I want, app is restarted so is the refresh
> >> of widgets/notifications!
>
> >> Having another app acting more or less the same, I know from
> >> experience that only alarms are not lost when the app is killed by the
> >> OS, even though I've always been unable to reproduce this manually, if
> >> the app has no alarm scheduled on regular intervals it ends up being
> >> permanently killed by the OS (?)
>
> >> Can someone tell me how the SCREEN_ON registration is affected when
> >> the app is killed by the OS, and how can I make sure it will receive
> >> the SCREEN_ON broadcast?
>
> >> Some users have already reported the issue of widget/notification not
> >> being refreshed anymore!
>
> >> After searching the web I understood that only the following will keep
> >> the app running:
> >> - An alarm is scheduled at regular intervals
> >> - Use of the startForeground() with a notification
> >> - The app activity is in the forerground
>
> >> I can't use any of the above because an alarm will constantly wake-up
> >> the app and the phone when there's actually nothing to do, the
> >> notifications are optional (user may only have the widget) and the app
> >> activity is obviously not always in the foreground.
>
> >> Another note/question: the app has an option to record the data,
> >> scheduled every 5 minutes, when this is on the app keeps running
> >> appropriately and widget/notification are not lost, though if the app
> >> gets killed I loose the past recording!
>
> >> Is there anyway to keep my service running and keep the SCREEN_ON
> >> registration at all time?
>
> >> Sorry for the long question, I'm trying to be exhaustive about this.
>
> >> --
> >> 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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to