What is WindowManager in android?

The Android WindowManager is a system service, which is responsible for managing the z-ordered list of windows, which windows are visible, and how they are laid out on screen. Among other things, it automatically performs window transitions and animations when opening or closing an app or rotating the screen. Every activity has a Window that … Read more

Android activity over default lock screen

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); try using this flags to disable lock screen when the activity is started. After API level 17 you can use <activity android:name=”.yourActivityName” android:showOnLockScreen=”true” android:screenOrientation=”sensorPortrait” > showOnLockScreen like in the example…

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

if you use apiLevel >= 19, don’t use WindowManager.LayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT which gets the following error: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@40ec8528 — permission denied for this window type Use this instead: LayoutParams.TYPE_TOAST or TYPE_APPLICATION_PANEL

What APIs are used to draw over other apps (like Facebook’s Chat Heads)?

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 Service { private WindowManager windowManager; private ImageView … Read more

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

Instead of : Context appContext = this.getApplicationContext(); you should use a pointer to the activity you’re in (probably this). I got bitten by this today too, the annoying part is the getApplicationContext() is verbatim from developer.android.com 🙁

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)