android-windowmanager

Android: Unable to add window. Permission denied for this window type

拟墨画扇 提交于 2019-11-26 10:22:36
I'm working on an app where I need to display a window with some info ON the Lock Screen (KeyGuard) without unlocking the phone. I figured I could probably do it with WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG But every time my app crashes with the following error: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@40ec8528 -- permission denied for this window type These posts ( here , here and here ) all give the same answer. To add the following permission in the Manifest file. android.permission.SYSTEM_ALERT_WINDOW Solution that I have

Android 'Unable to add window — token null is not for an application' exception

走远了吗. 提交于 2019-11-26 09:25:35
问题 I get the following Android exception when I try to open a dialog. Can someone please help me understand what is going on and how can I fix this problem? android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRoot.setView(ViewRoot.java:509) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.app.Dialog.show(Dialog.java:241)

Android activity over default lock screen

微笑、不失礼 提交于 2019-11-26 01:46:28
问题 How can I display an Activity or Dialog to be visible over the lock screen? I have already tried displaying my lock activity when screen turns on by setting various window type in Activity.onCreate() method: TYPE_PRIORITY_PHONE TYPE_SYSTEM_ALERT TYPE_KEYGUARD and others together with SYSTEM_ALERT_WINDOW and INTERNAL_SYSTEM_WINDOW permissions. My activity is visible after I unlock the device. UPDATE: I actually already managed to display my own Activity instead of default lock screen. It work

Android: Unable to add window. Permission denied for this window type

最后都变了- 提交于 2019-11-26 01:07:45
问题 I\'m working on an app where I need to display a window with some info ON the Lock Screen (KeyGuard) without unlocking the phone. I figured I could probably do it with WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG But every time my app crashes with the following error: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@40ec8528 -- permission denied for this window type These posts (here, here and here) all give the same answer. To add the

Android 1.6: “android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an application”

断了今生、忘了曾经 提交于 2019-11-25 22:48:28
问题 I\'m trying to open a dialog window, but every time I try to open it it throws this exception: Uncaught handler: thread main exiting due to uncaught exception android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRoot.setView(ViewRoot.java:460) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.app.Dialog.show(Dialog.java

What APIs in Android is Facebook using to create Chat Heads?

走远了吗. 提交于 2019-11-25 22:37:07
问题 How does Facebook create the Chat Heads on Android? What is the API to create the floating views on top of all other views? 回答1: This one: Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications. Very few applications should use this permission; these windows are intended for system-level interaction with the user. Constant Value: "android.permission.SYSTEM_ALERT_WINDOW" //EDIT: The full code here: public class ChatHeadService extends

Android activity over default lock screen

倖福魔咒の 提交于 2019-11-25 20:32:01
How can I display an Activity or Dialog to be visible over the lock screen? I have already tried displaying my lock activity when screen turns on by setting various window type in Activity.onCreate() method: TYPE_PRIORITY_PHONE TYPE_SYSTEM_ALERT TYPE_KEYGUARD and others together with SYSTEM_ALERT_WINDOW and INTERNAL_SYSTEM_WINDOW permissions. My activity is visible after I unlock the device. UPDATE: I actually already managed to display my own Activity instead of default lock screen. It work perfectly unless you use HOME button. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN