My alarm manager killed after my app killed in android
<p>I have an <code>AlarmManager</code> that shows a <code>Toast</code> every 10 mins.but when os kill apps in the background , so my <code>AlarmManager</code> not work any more. what I have to do?</p>

<pre><code>public class MyReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context con, Intent arg1) {
        Global.ShowMessage(con, Global.GetCurrentDateTime());

    }
}
</code></pre>

<p>In <code>Manifest.xml</code> :</p>

<pre><code> &lt;receiver android:name=".MyReceiver" &gt; &lt;/receiver&gt;
</code></pre>

<p>in main <code>Activity</code> : </p>

<pre><code> AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);

        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.SECOND, 10);

        long time = cal.getTimeInMillis();

        Intent i = new Intent(this, MyReceiver.class);

        PendingIntent pi = PendingIntent.getBroadcast(this, 9854, i,  PendingIntent.FLAG_UPDATE_CURRENT);

        // am.set(AlarmManager.RTC_WAKEUP,time,pi);

        am.setInexactRepeating(AlarmManager.RTC_WAKEUP, time, 600 * 1000, pi);
</code></pre>