Hi I'm creating a app to display the count of alarm that comes from services and i've to update that when my screen is lock.
but i am getting a out put but it is not updating can any one help me
this is a code i used for display the text in lock screen
String message ="New alarm :"+ alarmnew.size()+"\n old alarm :"+alarmold.size();
Settings.System.putString(this.getContentResolver(),
Settings.System.NEXT_ALARM_FORMATTED, message);
for that first you need unlock the screen then update display and again lock the screen. you can lock or unlock screen by using, window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD); and DevicePolicyManager lockNow() method.
Actually when screen locks ,your application goes to onPause() but the services of the application keeps running as they runs in background.Hence, to solve your problem you need to wakeup your application for fraction of second then update the screen and then again lock the screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With