I follow the AndroidHive tutorial to create an Android floating widget like Facebook Chat Head. The application starts successfully and shows a floating icon. The problem occurs when the screen is locked, the floating icon disappears when the screen turns off. I recently worked on opening activity from the lock screen. The following code is added before setcontentview () works fine. But where to add this parameter to the service.
Window wind = this.getWindow();
wind.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
wind.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
wind.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
Any idea to show a floating icon on the screen is locked?
source
share