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_CONNECTED flg=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 [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