android - Is it possible to set the SharedPreference in the BroadcastReceiver? -
i need generate notification using broadcastreceiver
, need save data in broadcastreceiver
class.
so, used sharedpreference
. not able save data insharedpreference`.
sharedpreferences pref_date; public static final string mypreferences = "myprefs"; pref_date = context.getsharedpreferences(mypreferences,context.mode_private); _ed = pref_date.edit(); string t="hello"; _ed.putstring(_date,t); _ed.putstring(flag,"0"); _ed.commit();
yes, shareppreference kind of file has key-value pairs store , retrieve. can access anywhere within application. services created application.
Comments
Post a Comment