title: How to Set up Alarm Same like Alarm App in Android?
body: <p>I am trying to setup alarm outside of my app with little popup box. I made that popup box by using Activity.I been trying for a long time to setup alarm like Alarm app but i get failed in some situations.</p>
  
  <p>I am successful if i am exiting the app from the launch activity by using back button. </p>
  
  <p>But when i press home button the alarm keep working charm but with last used activity in background.  </p>
  
  <p>I am not sure why this happening and i would like to know how i can make this work with out any activity in background when i pressed home button.</p>
  
  <p>Here is my onReceiver Code.</p>
  
  <pre><code>@Override
  public void onReceive(Context context, Intent intent) {
  
  
      try {
           Bundle bundle = intent.getExtras();
           String message = bundle.getString("alarm_message");
  
           Intent newIntent = new Intent(context, ReminderPopupMessage.class);
           newIntent.putExtra("alarm_message", message);
           newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
           newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
           context.startActivity(newIntent);
          } catch (Exception e) { 
           e.printStackTrace();
  
          }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>If you guys provide the link for actual alarm app code that would be fabulous.</p>
  
  <p>Thanks for your help guys.</p>