Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change system alarm setting text dynamic

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 my output

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);
like image 213
Jagan Avatar asked Sep 11 '12 07:09

Jagan


1 Answers

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.

like image 125
dd619 Avatar answered Sep 29 '22 11:09

dd619