Oh, I did not understand the question, apologies. Good point!
I fixed that, so everything is handled by a single process that
receives both on and off broadcasts.
Thanks.


On Jan 6, 6:01 pm, ArtJin <[email protected]> wrote:
> I just changed my service class to run the thread loop with handler,
> instead of creating a scheduled alarm.
> This way my app is able to react on screen changes, since SCREEN_ON/
> OFF broadcasts are available only when actively registered.
> Lots of learning today :-)
> Thanks a bunch for your help.
>
> On Jan 6, 5:23 pm, ArtJin <[email protected]> wrote:
>
> > Got it thanks.
>
> > To answer your question let me describe what I am trying to do.
> > I have an AlarmManager that runs a service, which connects to web
> > server and gets some data.
> > Everything works fine, but battery drains quickly since AlarmManager
> > stops running only when CPU stops.
> > So I wanted to reschedule the AlarmManager according to screen's on/
> > off situation, since I do not really need it running when user is not
> > looking at the screen.
> > I guess I need to re-think the design approach.
> > What would you recommend?
> > Thanks again for quick response! :-)
>
> > On Jan 6, 5:02 pm, "Dianne Hackborn" <[email protected]> wrote:
>
> > > These are currently only delivered to receivers actively registered with
> > > registerReceiver().
>
> > > On a side note...  why are you running your receivers in a separate
> > > process??
>
> > > On Tue, Jan 6, 2009 at 1:57 PM, ArtJin <[email protected]> wrote:
>
> > > > Hello everybody.
> > > > Carter, did you find out what was the problem?
> > > > I am having exact same issue.
> > > > the receivers are installed with no problems, however they do not
> > > > receive SCREEN_ON orSCREEN_OFFbroadcasts for some reason, unless I
> > > > do everything programatically.
> > > > Here is the receiver snippet from my manifest:
> > > > <receiver android:name=".ScreenOnBroadcastReceiver"
> > > > android:process=":remote">
> > > >  <intent-filter>
> > > >   <action android:name="android.intent.action.SCREEN_ON"></action>
> > > >  </intent-filter>
> > > > </receiver>
> > > > <receiver android:name=".ScreenOffBroadcastReceiver"
> > > > android:process=":remote">
> > > >  <intent-filter>
> > > >    <action android:name="android.intent.action.SCREEN_OFF"></action>
> > > >  </intent-filter>
> > > > </receiver>
>
> > > > Ideas are appreciated!
> > > > Thanks :-)
>
> > > > On Dec 4 2008, 1:22 pm, Carter <[email protected]> wrote:
> > > > > I'm trying to detect when the phone's screen turns on and off with the
> > > > > SCREEN_ON andSCREEN_OFFIntents.  A BroadcastReceiver declared in the
> > > > > AndroidManifest doesn't work with these screen on/off Intents, but
> > > > > instantiating a BroadcastReceiver programatically at runtime does
> > > > > work.
>
> > > > > As far as troubleshooting goes: my AndroidManifest BroadcastReceiver
> > > > > is properly receiving other Intents, such as for phone boot.  There is
> > > > > no helpful information in LogCat.  And this isn't a permissions issue,
> > > > > since it works when declared programatically.
>
> > > > > There are no explanations in the JavaDocs (e.g. its not like the
> > > > > battery changed Intent which cannot be declared in the Manifest),
> > > > > although when searching through the Android source I discovered that
> > > > > none of the Android OS services declare interest this particular
> > > > > Intent in XML either.
>
> > > > > So any ideas why I can't declare SCREEN_ON andSCREEN_OFFin the
> > > > > AndroidManifest?
>
> > > --
> > > Dianne Hackborn
> > > Android framework engineer
> > > [email protected]
>
> > > Note: please don't send private questions to me, as I don't have time to
> > > provide private support.  All such questions should be posted on public
> > > forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to