android.intent.action.BATTERY_OKAY 在广播接收器中不工作,在广播接收器中做什么?
android.intent.action.BATTERY_OKAY is not working in broadcast receiver, what to do in broadcast receiver?
清单:
<receiver android:name=".BatteryFullReceiver" >
<intent-filter>
<action android:name="android.intent.action.BATTERY_OKAY" />
</intent-filter>
</receiver>
广播接收器:
public class BatteryFullReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
// String intentAction = intent.getAction();
// if(Intent.ACTION_BATTERY_OKAY.equalsIgnoreCase(intentAction)){
Toast.makeText (context, "Battery Full", Toast.LENGTH_LONG).show ();
Speaker.tts.speak("Battery full ,you can disconnect the usb now", TextToSpeech.QUEUE_ADD, null);
}
// }
}
我试过电池电量不足,但 works.but 电池正常但无法正常工作。有时我使用了那些代码,这就是为什么我对 checking.but 使用评论没有什么 working.please 帮助 !!!
您拼错了意图操作:
android.intent.action.ACTION_BATTERY_OKAY
清单:
<receiver android:name=".BatteryFullReceiver" >
<intent-filter>
<action android:name="android.intent.action.BATTERY_OKAY" />
</intent-filter>
</receiver>
广播接收器:
public class BatteryFullReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
// String intentAction = intent.getAction();
// if(Intent.ACTION_BATTERY_OKAY.equalsIgnoreCase(intentAction)){
Toast.makeText (context, "Battery Full", Toast.LENGTH_LONG).show ();
Speaker.tts.speak("Battery full ,you can disconnect the usb now", TextToSpeech.QUEUE_ADD, null);
}
// }
}
我试过电池电量不足,但 works.but 电池正常但无法正常工作。有时我使用了那些代码,这就是为什么我对 checking.but 使用评论没有什么 working.please 帮助 !!!
您拼错了意图操作:
android.intent.action.ACTION_BATTERY_OKAY