Short story: My dialog is hidden when a specific activity is displayed. When other activities are showing, the dialog can be seen fine.
Long story: I have an activity which uses the following flags:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES);
It also uses the PROXIMITY_SCREEN_OFF_WAKE_LOCK
in order to turn off the screen when you put the phone against your face.
This activity is defined in the manifest as follows:
<activity
android:name=".ui.MyHidingActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleInstance"
android:windowSoftInputMode="stateHidden"></activity>
Now, when an event happens in the application I want to create and show this dialog:
KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
final KeyguardManager.KeyguardLock kl = km.newKeyguardLock("com.mycompany.myproject");
kl.disableKeyguard();
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.FULL_WAKE_LOCK, "My_App");
wl.acquire();
final AlertDialog alertDialog = new AlertDialog.Builder(tabActivity).create();
alertDialog.getWindow().addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
alertDialog.setTitle("Incoming Event");
alertDialog.setMessage("You have an incoming event.");
alertDialog.show();
wl.release();
The dialog displays fine when any other activity is displayed, except for that MyHidingActivity
which hides the dialog for whatever reason. Any idea what may be the problem?