You cannot register for ACTION_BATTERY_CHANGED in the manifest. You
can only listen for this broadcast via registerReceiver() from an
existing, running component.

On Wed, Jul 18, 2012 at 3:57 PM, krishna kumar <[email protected]> wrote:
> Hi All
>
> Not working my recever why ?
>
> here my code please help me
>
> ====
> import android.content.BroadcastReceiver;
> import android.content.Context;
> import android.content.Intent;
> import android.util.Log;
>
> public class MyRecever extends BroadcastReceiver {
>
>     @Override
>     public void onReceive(Context context, Intent intent) {
>
>
>        int level = intent.getIntExtra("level", 0);
>        Log.i("MyRecever", "--->>"+level);
>
>
>     }
>
> }
> ====manifest.xml===
>
> <?xml version="1.0" encoding="utf-8"?>
> <manifest xmlns:android="http://schemas.android.com/apk/res/android";
>     package="my.custom"
>     android:versionCode="1"
>     android:versionName="1.0" >
>
>     <uses-sdk android:minSdkVersion="7" />
>     <uses-permission android:name="android.permission.BROADCAST_STICKY"/>
>     <uses-permission android:name="android.permission.BATTERY_STATS"/>
>
>     <application
>         android:icon="@drawable/ic_launcher"
>         android:label="@string/app_name" >
>         <activity
>             android:name=".CustomserviceActivity"
>             android:label="@string/app_name" >
>             <intent-filter>
>                 <action android:name="android.intent.action.MAIN" />
>
>                 <category android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>         </activity>
>         <receiver android:name="MyRecever"
>             android:enabled="true"
>              android:permission="android.permission.BROADCAST_STICKY">
>             <intent-filter>
>                 <action
> android:name="android.intent.action.BATTERY_CHANGED"/>
>             </intent-filter>
>         </receiver>
>     </application>
>
> </manifest>
>
>
> --
> 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



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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