@@ -0,0 +1,1726 @@
+/**   %0A * @Title: BatteryStateReceiver.java %0A * @Package me.pc.mobile.helper.receiver %0A * @Description: TODO%0A * @author SilentKnight %7C%7C happychinapc@gmail.com   %0A * @date 2014 2014-11-18 %E4%B8%8B%E5%8D%882:23:32 %0A * @version V1.0.0   %0A */%0Apackage me.pc.mobile.helper.v14.receiver;%0A%0Aimport android.content.BroadcastReceiver;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.os.Bundle;%0Aimport me.pc.mobile.helper.v14.util.LogUtil;%0A%0A/**%0A * @author SilentKnight %0A * declare this in your AndroidManifest.xml: %7B@code%7D%0A *         %3Creceiver android:name=%22com.home.receiver.BatteryReceiver%22%3E%0A *         %3Cintent-filter%3E %0A *         %3Caction android:name=%22android.intent.action.BATTERY_CHANGED%22 /%3E %0A *         %3Caction android:name=%22android.intent.action.BATTERY_OKAY%22/%3E %0A *         %3Caction android:name=%22android.intent.action.BATTERY_LOW%22/%3E %0A *         %3C/intent-filter%3E%0A *         %3C/receiver%3E%7B@code%7D%0A */%0Apublic class BatteryStateReceiver extends BroadcastReceiver %7B%0A%0A%09private static final String TAG = BatteryStateReceiver.class%0A%09%09%09.getSimpleName();%0A%0A%09/*%0A%09 * (non-Javadoc)%0A%09 * %0A%09 * @see android.content.BroadcastReceiver#onReceive(android.content.Context,%0A%09 * android.content.Intent)%0A%09 */%0A%09@Override%0A%09public void onReceive(Context context, Intent intent) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) %7B%0A%09%09%09// to do%0A%09%09%7D else if (Intent.ACTION_BATTERY_OKAY.equals(intent.getAction())) %7B%0A%09%09%09// to do%0A%09%09%7D else if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) %7B%0A%09%09%09Bundle bundle = intent.getExtras();%0A%09%09%09int current = bundle.getInt(%22level%22);%0A%09%09%09int total = bundle.getInt(%22scale%22);%0A%09%09%09LogUtil.info(TAG, %22Current Battery is: %22 + (current * 100 / total));%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create BatteryStateReceiver.java