Android's floating windows coupled with FLAG
My app, shows a dialog box to the user before the lock screen. It's a simple Activity that contains DialogFragments (from the support library as this app runs on 2.2+).
Since the actual activity that displayed those dialogs was not a floating window by Android's standards,
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
worked fine.
However, I was thinking I'd use an Activity that looks like a Dialog instead. All the Dialog themes (Holo, etc), though, have this item:
<item name="android:windowIsFloating">true</item>
This, for some reason causes the window flag to be completely ignored. Interestingly, the Activity gets shown after the user unlocks the screen.
Why would this be so, and is there a way around it?
Suffering from the same issue. The only thing that seems to work in this issue is
KeyguardManager myKeyGuard = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
myLock = myKeyGuard.newKeyguardLock("tagName");
myLock.disableKeyguard();
Dont forget to use the keyguard permission in manifest:
<uses-permission android:name = "android.permission.DISABLE_KEYGUARD"/>
链接地址: http://www.djcxy.com/p/66268.html
上一篇: 添加带状按钮,如“打开”,并放下
下一篇: Android的浮动窗口加上FLAG