我试图从onStartCommand方法服务显示一个对话框
private Dialog incomingCallDialog;
incomingCallDialog = new Dialog(MyService.this, R.style.PopupDialog);
incomingCallDialog.setCancelable(false);
incomingCallDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
incomingCallDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
incomingCallDialog.setContentView(view);
Handler delayHandler = new Handler();
delayHandler.postDelayed(new Runnable() {
@Override
public void run() {
incomingCallDialog.show();
}
}, 100);
这段代码在SamsungS5拥有奇巧,当设备被锁定,但它不SamsungS6工作,其中有棒棒糖5.0.2在设备锁定时工作正常。
当设备被锁定对话框不显示棒棒糖的。