Shahzaib Official
Shahzaib Official

Reputation: 38

show text view on lock screen using window manager in Marshmallow+

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

Upvotes: 0

Views: 363

Answers (0)

Related Questions