I have an app that opens an Alert Dialog when a bluetooth device is connected / disconnected. The alert dialog is triggered by a BroadcastReceiver on connect of a Bluetooth device.
I want to open an alert dialog such that if I open my app (app A) > long press home > go to a different app (app B), bluetooth device is connected -> my alert from app A will be displayed on top of app B.
What's happening now is that I can only see the dialog if I go back to app A
My current code:
final AlertDialog.Builder dialog = new AlertDialog.Builder(activity,
AlertDialog.THEME_DEVICE_DEFAULT_DARK);
... some setting here
final AlertDialog alert = dialog.create();
alert.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
alert.show();