Show AlertDialog in service without window type

74 views Asked by At

I will try to explain what I'm interested in and I will be happy if you can help me. Do you know some way to show AlertDialog outside of activity (in service) without setting type TYPE_SYSTEM_ALERT / TYPE_APPLICATION_OVERLAY? for example presetting it globally with some way, maybe with ContextWrapper (I dont know if it can be done) and then create AlertDialog in standard way? it may seem like a strange question, but I need it because I can't set type for some external alertdialogs, finally my goal is to make this code working in service

AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle("Example")
.setMessage("Example")
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialogInterface, int i) {
        dialogInterface.dismiss();
    }
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
0

There are 0 answers