Tuesday, January 24, 2012

[android-developers] Re: ACTION_POWER_CONNECTED broadcast receiver not recognize by ICS

I hope this is a software bug, and can be fixed in next firmware
release, maybe 4.0.4.

On Jan 24, 8:36 am, Mark Murphy <mmur...@commonsware.com> wrote:
> You cannot register for ACTION_BATTERY_CHANGED from the manifest. It
> has to be via registerReceiver() in Java code.
>
>
>
>
>
>
>
>
>
> On Mon, Jan 23, 2012 at 5:21 PM, SimonP <snpre...@hotmail.com> wrote:
> > No idea but I'm also looking for a solution, I'm using a nearly
> > identical bit of code to you and getting the same error.
>
> > The really weird thing was I changed a load of code to see if I could
> > get an event from just the battery level changing instead.
>
> > I used the following in the manifest:
> > <receiver android:name=".receiver.OnPowerReceiver"
> > android:enabled="true" android:exported="true">
> >     <intent-filter>
> >         <action
> > android:name="android.intent.action.ACTION_BATTERY_CHANGED" />
> >     </intent-filter>
> > </receiver>
>
> >  and it still happened, even placing it into a new project and new
> > AVB.
>
> > Basically I know I have not referencedACTION_POWER_CONNECTEDin
> > anything I put in there but in the eclipse LogCat logs I still get the
> > exact same error as before referencing it;  The only value I have seen
> > change is the number in brackets in PowerUI(xxxx).
>
> > Anyone got any ideas?  What am I doing wrong, I know it'll be
> > something obvious but I'm battering my head off the desk at this
> > point...
>
> > On Jan 8, 1:32 pm, cl <cllam2...@gmail.com> wrote:
> >> I wanted to detect when the phone is pluged into the charger.
>
> >> I created a BroadcastReceiver as below
>
> >> public class PowerReceiver extends BroadcastReceiver {
> >>     public void onReceive(Context context, Intent intent) {
> >>         if (intent.getAction().equals(Intent.ACTION_POWER_CONNECTED))
> >> {
> >>             Log.d("DEBUG", "Power connected...");
> >>         }
> >>     }
>
> >> }
>
> >> with following in the manifest
>
> >>     <receiver android:name=".PowerReceiver" >
> >>         <intent-filter>
> >>             <action
> >> android:name="android.intent.action.ACTION_POWER_CONNECTED" />
> >>         </intent-filter>
> >>     </receiver>
>
> >> Everything work as expected on 2.2 (emulator and phone), but on ICS
> >> (emulator 4.0.3 and phone 4.0.1),
> >> the LogCat show
>
> >> 01-08 21:02:02.090: W/PowerUI(143): unknown intent: Intent
> >> { act=android.intent.action.ACTION_POWER_CONNECTEDflg=0x10000010 }
>
> >> Anybody know reason, and a solution. Thanks.
>
> > --
> > 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
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books

--
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


Real Estate