failing at registering receivers

Put your problem here if it does not fit any of the other categories.

failing at registering receivers

Postby v1nsai » Mon Sep 13, 2010 1:16 am

I've done this before I swear, but I can't for the life of me figure out why my BroadcastReceivers aren't receiving intents. I've registered them in AndroidManifest.xml as follows:
Code: Select all
           <receiver android:name=".ScreenOn">
              <intent-filter>
                 <action android:name="android.intent.action.SCREEN_ON" />
              </intent-filter>
           </receiver>
           <receiver android:name=".ScreenOff">
              <intent-filter>
                 <action android:name="android.intent.action.SCREEN_OFF" />
              </intent-filter>
           </receiver>

and eventually ended up commenting everything out in my ScreenOn BroadcastReceiver class and just adding a Toast.makeText() to it just to see if I would get a toast when I turn the screen on, but I'm not. I've probably just been staring at it for too long, but does anyone see what I'm doing wrong?
# cat /etc/signature/funny
User avatar
v1nsai
Developer
Developer
 
Posts: 26
Joined: Mon Aug 09, 2010 3:29 am

Top

Re: failing at registering receivers

Postby stratus » Mon Sep 13, 2010 11:34 am

stratus
Freshman
Freshman
 
Posts: 2
Joined: Wed Sep 08, 2010 12:09 pm

Re: failing at registering receivers

Postby v1nsai » Mon Sep 13, 2010 8:53 pm

No kidding, is that true? Never seen it mentioned anywhere before, sure would be nice if theyd mention that in the developer docs, but that would make sense because I sure as hell wasnt getting it to work in manifest lol.
# cat /etc/signature/funny
User avatar
v1nsai
Developer
Developer
 
Posts: 26
Joined: Mon Aug 09, 2010 3:29 am

Re: failing at registering receivers

Postby v1nsai » Mon Sep 13, 2010 9:24 pm

Registering a receiver in code means that its attached to the life cycle of the process, meaning that if I register it in an Activity it will get killed won't it? Would running it from a Service be the most efficient way to do this then?
# cat /etc/signature/funny
User avatar
v1nsai
Developer
Developer
 
Posts: 26
Joined: Mon Aug 09, 2010 3:29 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 32 guests