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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -