Reputation: 3
I am doing one small app in that app i am saving some values in intent using putExtra and sending that values to broadcast reciever.in broadcast if sms is sent i am getting the values using getstring.its working fine only when app is open.so i need to keep all the intent values even app is closed.
Upvotes: 0
Views: 65
Reputation: 505
// use getActivity if used from Fragment otherwise use this
SharedPreferences mSharedPreferences;
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putString("VAL", "AV");
editor.commit();
//get the data like
String value=mSharedPreferences.getString("VAL", "null")
Upvotes: 2