0

My application has an activity that is launched by a BroadcastReceiver when android.intent.action.BOOT_COMPLETED broadcast is received.

The activity should be shown full screen over Keyguard (secure). Activity is using Theme.NoTitleBar.Fullscreen theme, set in the app manifest and WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED to put the Keyguard behind.

I am not trying to replace or disable keyguard any way. The activity should just show some diagnostics info about the device and it should remain active until user closes it.

So, the device boots up, keyguard usually appears and the after few seconds activity is also launched. Activity is displayed nicely over the keyguard in full screen mode without title bar. All this worked fine on my Sony and Samsung test devices.

Today I was testing the app on LG G2 device (Android 4.4.2) and noticed a strange issue. The problem is that the fullscreen activity is dismissed (paused) and keyguard is brought up again.

I spent half day going through the code and trying to figure out what is causing this behavior. Then finally I noticed that my activity is dismissed every time when system notification is shown in title bar. In my case the notification is "Battery full" and "Unplug to save battery". I did not had a chance to test, but probably same will happen with other notifications.

Is there a way to suppress system notifications or ignore, so the full screen activity won't be paused?

leppie
  • 115,091
  • 17
  • 196
  • 297
jjarv
  • 71
  • 6

1 Answers1

0

Try with below code snippets,

  Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  this.sendBroadcast(intent);

This is broadcast when a user action should request a temporary system dialog to dismiss. Some examples of temporary system dialogs are the notification window-shade and the recent tasks dialog

Refer ACTION_CLOSE_SYSTEM_DIALOGS

Daud Arfin
  • 2,499
  • 1
  • 18
  • 37
  • I tried it, didn't worked. The strange thing is that when I have cable not connected (not charging), then everything works fine. I can even swipe screen and status bar area and it nicely appears over full screen activity without dismissing it. – jjarv Jun 29 '15 at 16:55
  • It turns out that it is not directly related to notifications bar. After some more testing I found out that LG device has a setting: PC Connection -> USB connection -> "Ask upon connecting". When this is unchecked it all works fine, if checked full screen activity is dismissed. Any ideas how to control this? – jjarv Jun 29 '15 at 19:51