0

In my app i was able to show text on lock screen using these params settings

params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
                    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                    |WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
            |WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED,
            PixelFormat.TRANSLUCENT);

but in android 6.0 and above where WindowManager.LayoutParams.TYPE_SYSTEM_ERROR is deprecated i used WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY

it shows overlays on every activity successfully but unable to show the View on lock screen, anyone can help me how to show a button or text view on lock screen using any way in android 6.0 and above thanks

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • why not use local notification to display text on lock screen ? – akshay_shahane Feb 21 '19 at 13:10
  • have you tried this----> https://stackoverflow.com/questions/7569812/how-can-i-interact-with-the-lockscreen-layout-to-display-text-into-it-like-this – akshay_shahane Feb 21 '19 at 13:12
  • yes @akshay_shahane i tried it but this method is for older versions not working in 6.0 and above – Shahzaib Official Feb 21 '19 at 13:33
  • notification is not my requirement, i wanna add floating buttons like facebook messenge on lock screen , android 6.0 and above – Shahzaib Official Feb 21 '19 at 13:34
  • have you added this Search for permission android.permission.SYSTEM_ALERT_WINDOW and WindowManager.LayoutParams.TYPE_SYSTEM_ALERT. – akshay_shahane Feb 21 '19 at 13:38
  • Yes i am using android.permission.SYSTEM_ALERT_WINDOW in manifest and WindowManager.LayoutParams.TYPE_SYSTEM_ALERT is deprecated in android 6.0 instead i have to use WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY but its not working – Shahzaib Official Feb 21 '19 at 13:47

0 Answers0