有人可以请帮我出来这个。 我想在手机电池电量不足时收到通知。 我androidManifest文件看起来像这样:没有得到电池低通知
<receiver android:name="com.dac.BatteryChangedBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BATTERY_LOW" />
</intent-filter></receiver>
和我接收的文件是:
public class BatteryChangedBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String intentAction = intent.getAction();
if(Intent.ACTION_BATTERY_LOW.equalsIgnoreCase(intentAction))
Toast.makeText(context, "Battery Power Low or Okay", Toast.LENGTH_LONG).show();
}
}
我改变使用telnet命令电池电量。我的手机电池确实发生了变化,但我没有收到任何敬酒信息。我甚至尝试使用代码注册接收器
嗨,我已经改变了我的接收器的包,但它仍然无法正常工作。 – ncst