我有一个问题:我可以在另一个应用程序上显示警报对话框吗?
我想在用户收到消息时通知他。显示标准通知是不够的。但是当我创建一个AlertDialog时,它不能在其他应用程序上显示。
private void showAlertDialog(View view, Order order, Order oldOrder) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
LayoutInflater inflater = LayoutInflater.from(context);
View content = inflater.inflate(R.layout.dialog_extra_info, null);
builder.setView(content);
final EditText etKmCounter = content.findViewById(R.id.et_km_counter);
final EditText etMotoHourCounter = content.findViewById(R.id.et_counter_moto_hour);
final AlertDialog ad = builder.show();
Button btnSave = content.findViewById(R.id.save);
btnSave.setOnClickListener(v -> {
if (StringUtils.isEmpty(etKmCounter.getText().toString()) || StringUtils.isEmpty(etMotoHourCounter.getText().toString())) {
openFillDataAlertDialog();
} else {
ad.dismiss();
}
});
}发布于 2019-10-21 13:40:32
你需要有ACTION_MANAGE_OVERLAY_PERMISSION权限才能在你的应用程序未打开时显示提醒对话框,或者如果你也想在其他应用程序上显示对话框。
检查这个链接,我在这里提到了所有细节:pop up wiindow with notification even apllication is not running
https://stackoverflow.com/questions/58480052
复制相似问题