//发送广播
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SHUTDOWN);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);//该语句为设置为前台广播
context.sendBroadcast(intent);
//发送广播
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SHUTDOWN);
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);//该语句为设置为前台广播
context.sendBroadcast(intent);