package Ġcom . hus se in . startup Ċ Ċ import Ġandroid . app . Alarm Manager Ċ import Ġandroid . app . Pending Intent Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . content . SharedPreferences Ċ import Ġjava . util .* Ċ Ċ class ĠSave Data { ĊĊĠĠĠ Ġvar Ġcontext : Context ?= null ĊĠĠĠ Ġvar Ġshared Ref : SharedPreferences ?= null ĊĠĠĠ Ġconstructor ( context : Context ){ ĊĠĠĠĠĠĠĠ Ġthis . context = context ĊĠĠĠĠĠĠ Ġshared Ref = context . get SharedPreferences (" my ref ", Context . MODE _ PRIVATE ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠSave Data ( hour : Int , minute : Int ){ ĊĠĠĠĠĠĠ Ġvar Ġeditor = shared Ref !!. edit () ĊĠĠĠĠĠĠĠ Ġeditor . put Int (" hour ", hour ) ĊĠĠĠĠĠĠĠ Ġeditor . put Int (" minute ", minute ) ĊĠĠĠĠĠĠĠ Ġeditor . commit () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġ Ġget Hour (): Int { ĊĠĠĠĠĠĠĠ Ġreturn Ġshared Ref !!. getInt (" hour ", 0 ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġfun Ġ Ġget Minute (): Int { ĊĠĠĠĠĠĠĠ Ġreturn Ġshared Ref !!. getInt (" minute ", 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Alarm (){ ĊĠĠĠĠĠĠĠ Ġval Ġhour : Int = get Hour () ĊĠĠĠĠĠĠĠĠ Ġval Ġminute : Int = get Minute () ĊĠĠĠĠĠĠĠ Ġval Ġcal ender = Calendar . getInstance () ĊĠĠĠĠĠĠĠ Ġcal ender . set ( Calendar . HOUR _ OF _ DAY , hour ) ĊĠĠĠĠĠĠĠ Ġcal ender . set ( Calendar . MINUTE , minute ) ĊĠĠĠĠĠĠĠ Ġcal ender . set ( Calendar . SECOND , 0 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġam = Ġcontext !!. getSystem Service ( Context . ALARM _ SERVICE ) Ġas ĠAlarm Manager ĊĊĠĠĠĠĠĠĠ Ġvar Ġintent = Intent ( context , my Broadcast Receiver :: class . java ) ĊĠĠĠĠĠĠĠ Ġintent . putExtra (" message "," Ġalarm Ġtime ") ĊĠĠĠĠĠĠĠ Ġintent . action =" com . tester . alarm manager " ĊĠĠĠĠĠĠĠ Ġval Ġpi = Pending Intent . get Broadcast ( context , 0 , intent , Pending Intent . FLAG _ UPDATE _ CURRENT ) ĊĊĊĠĠĠĠĠĠĠ Ġam . set Repe ating ( Alarm Manager . RTC _ WAKE UP , cal ender . time In Millis , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAlarm Manager . INTERVAL _ DAY , pi ) ĊĊĊĊĠĠĠ Ġ} Ċ } Ċ