I have already read some tutorials and read the documentation, but I can't make this work... This is what I have been testing:
This is the way I register the intent to be called with the alarm manager:
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, 1)
PendingIntent sender = PendingIntent.getBroadcast(this, 192837, new Intent(this, AlarmReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), sender);
My AlarmReceiver:
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent intent2 = new Intent(context, NewCommit.class);
context.startActivity(intent2);
}
}
And of course I added the receiver in the androidManifest.xml:
<receiver android:process=":remote" android:name="AlarmReceiver"></receiver>
And is INSIDE the application tag.
Any idea? It's driving me crazy, I can't find what's wrong!
Thanks
I just added to the intent from pendingIntent:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
I hope in helps someone!