Reputation: 1928
I follow the tutorial of AndroidHive to create an Android Floating Widget like Facebook Chat Head. The app runs successfully and shows the floating icon. The problem occurs while the screen locked, the floating-icon
disappears when the screen goes off. I recently worked on to open activity from the lock screen. The following code added before setContentView()
work perfectly.
But where to add this parameter in 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 floating icon on screen locked?
Upvotes: 5
Views: 843