Trying to set a SharedPreference using the ON_BOOT_COMPLETED Broadcast Receiver
<p>I am having an enormous amount of difficulty in setting a SharedPreference every time the user's device is rebooted. </p>

<p>I posted this question a few days ago and received two answers, both of which regarded errors in my code which I have corrected, however, the problem persists.</p>

<p>Any help would be supremely appreciated.</p>

<p>Here's my code:</p>

<p><strong>MyReceiver.java</strong></p>

<pre><code>       package ***************;

    import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;

public class MyReceiver extends BroadcastReceiver {
    SharedPreferences mPrefs;

    @Override
    public void onReceive(Context context, Intent intent) {

        String TAG ="MyReceiver";
        Log.d(TAG,"Did I Run?" );

        mPrefs = context.getSharedPreferences("myAppPrefs", 0); 
        SharedPreferences.Editor edit = mPrefs.edit();

        edit.putString("status", "Masqed Crusader is OFFLINE");
         edit.commit();
      }

}
</code></pre>

<p><strong>Android Manifest</strong></p>

<pre><code>     &lt;?xml version="1.0" encoding="utf-8"?&gt;
        &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
              android:versionCode="1" package="*********" android:versionName="1.8.3"&gt;
                  &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
                &lt;activity android:name=".Main"
                          android:label="@string/app_name"
                          android:configChanges="keyboardHidden|orientation"                                 
    android:screenOrientation="portrait"&gt;
                         &lt;intent-filter&gt;
                        &lt;action android:name="android.intent.action.MAIN" /&gt;
                        &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
                    &lt;/intent-filter&gt;
                &lt;/activity&gt;

                &lt;activity android:name="help"&gt;&lt;/activity&gt;

    &lt;receiver android:name=".MyReceiver"&gt;

                &lt;intent-filter&gt; 
                        &lt;action android:name="android.intent.action.BOOT_COMPLETE"/&gt; 

                &lt;/intent-filter&gt; 
  &lt;/receiver&gt;
&lt;/application&gt;
    &lt;uses-sdk android:minSdkVersion="4" /&gt;


&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"&gt;&lt;/uses-permission&gt;
&lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"&gt;&lt;/uses-permission&gt;

&lt;uses-permission android:name="android.permission.READ_PHONE_STATE"&gt;&lt;/uses-permission&gt;

&lt;/manifest&gt; 
</code></pre>

<p>The SharedPreferences are setup in my Main activity. My goal is to get the ON_BOOT_COMPLETED broadcast to trigger the MyReceiver activity, which resets a specific sharedPreference, however, when I try this, the SharedPref is not reset.</p>

<p>What am I doing wrong? </p>
