下你所需,载你所想!
汇集开发技术源码资料

android broadcast实例

:47.408KB :1 :2021-11-29 20:22:12

部分简介

android broadcast实例对于感兴趣的可以参考。
private BroadcastReceiver batInfoReceiver = new BroadcastReceiver() {

public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
//如果捕捉到的action是ACTION_BATTERY_CHANGED,
//就运行onBatteryInfoReceiver()
if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
intLevel = intent.getIntExtra("level", 0);
intScale = intent.getIntExtra("scale", 100);
onBatteryInfoReceiver(intLevel, intScale);
}
}
};

android broadcast实例

热门推荐

相关文章