title: Android: My Alarm isn't being Started by my BOOTCOMPLETED receiving class
body: <p>I have a problem I haven't been able to figure out. I have a repeating alarm broadcast receiver and I've set up another broadcast receiver to receive the BOOT_COMPLETE signal in order to restart my alarm upon booting. The code looks like everyone else's that I've looked up, so I'n not sure what's wrong.</p>
  
  <p>My Boot receiver:</p>
  
  <pre><code>public class DeviceBootReceiver extends BroadcastReceiver {
  Context context2;
  
  public boolean fileExistance(String fname){
      File file = context2.getApplicationContext().getFileStreamPath(fname);
      return file.exists();
  }
  
  
  
  
  public String loadCurrentWhat (String filename){
      FileInputStream fileInputStream;
      String info = "";
      try {
          fileInputStream = context2.getApplicationContext().openFileInput(filename);
          int count;
          while ((count=fileInputStream.read()) != -1){
              info += Character.toString((char)count);
          }
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
      return info;
  }
  
  @Override
  public void onReceive(Context context, Intent intent) {
      context2 = context;
          if (fileExistance("number")){
                   /* Setting the alarm here */
                  Intent alarmIntent = new Intent(context, AlarmReceiver.class);
                  PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, 0);
  
                  AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
                  int interval = 10000;
                  manager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), interval, pendingIntent);
          }
  
  }
  }
  </code></pre>
  
  <p>My Repeating alarm:</p>
  
  <pre><code>public class AlarmReceiver extends BroadcastReceiver {
  
  
  Context context2;
  
  @Override
  public void onReceive(Context context, Intent intent) {
  
      // For our recurring task, we update the character data in internal storage.
      context2 = context.getApplicationContext();
      UPDATE();
  
  }
  }
  </code></pre>
  
  <p>My Manifest:</p>
  
  <pre><code> &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;
  
      &lt;activity android:name=".MainActivity"&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=".CardFullView"/&gt;
  
      &lt;receiver
          android:name=".DeviceBootReceiver"
          android:enabled="true"
          android:exported="false"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;receiver
          android:name=".AlarmReceiver"&gt;
      &lt;/receiver&gt;
  
  
  
  &lt;/application&gt;
  </code></pre>