http://stackoverflow.com/questions/2575242/android-intent-action-screen-on-doesnt-work-as-a-receiver-intent-filter
Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Sat, Jul 2, 2011 at 12:03 AM, 3c <[email protected]> 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 [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

