Note that there are some explanatory texts on larger screens.

plurals
  1. POAlarm only triggers when I'm in the Activity that set it
    primarykey
    data
    text
    <p>I'm creating an alarm in my app from the <code>ItemEdit Activity</code>. Its where one can edit/view their note/todo item, they can also set a reminder/alarm for the item there. I set the alarm with the following code:</p> <pre><code>private void createAlarm() { Intent intent = new Intent(this, ReminderReceiver.class); intent.putExtra("reminder_message", "Reminder Received!"); intent.putExtra("item_id", mRowId); PendingIntent sender = PendingIntent.getBroadcast( getApplicationContext(), ALARM_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT); // Get the AlarmManager service AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); // Set alarm to the time given by the user. am.set(AlarmManager.RTC_WAKEUP, mReminderCal.getTimeInMillis(), sender); } </code></pre> <p>And here is the Receiver</p> <pre><code> public class ReminderReceiver extends BroadcastReceiver { private static final String TAG = "MyApp"; @Override public void onReceive(Context context, Intent intent) { try { Bundle bundle = intent.getExtras(); String message = bundle.getString("reminder_message"); Log.v(TAG, message); } catch(Exception e) { Log.v(TAG, "OH SNAP!"); e.printStackTrace(); } } </code></pre> <p>Edit: Also I have the following in my manifest:</p> <p><code>&lt;receiver android:process=":remote" android:name="ReminderReceiver"&gt;&lt;/receiver&gt;</code></p> <p>If I stay in the <code>Activity</code> where I set the alarm it is received fine. If I hit the back button to return to my <code>ListActivity</code> where all the items are listed or leave the app entirely the alarm never triggers. Have I done something wrong in setting up my alarm that it only triggers from the Activity that set it?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload