title: Toast message at fix time daily,even when app gets close in android
body: <p>I want simple toast message to be shown at 2:00p.m daily even if app gets close.
      Please help me.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Calendar calendar = Calendar.getInstance();
          calendar.set(Calendar.HOUR_OF_DAY, 12);
          calendar.set(Calendar.MINUTE, 47);
          calendar.set(Calendar.SECOND, 0);
          Intent intent1 = new Intent(MainActivity.this, AlarmReceiver.class);
          PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0,intent1, PendingIntent.FLAG_UPDATE_CURRENT);
          AlarmManager am = (AlarmManager) MainActivity.this.getSystemService(MainActivity.this.ALARM_SERVICE);
          am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
      }
  }
  </code></pre>
  
  <p>AlarmReceiver.java</p>
  
  <pre><code>public class AlarmReceiver extends BroadcastReceiver {
      int MID = 0;
      @Override
      public void onReceive(Context context, Intent intent) {
          // TODO Auto-generated method stub
          Log.i("dummy","sjcdbfsnbf");
              // For our recurring task, we'll just display a message
              Toast.makeText(context, "I'm running", Toast.LENGTH_SHORT).show();
  
          }
  
      }
  </code></pre>