I downloaded 4.1.2 and uninstalled 4.4 from my ADT.
I set "Build Target" to 4.1.2 and cleaned and rebuilt my app and have reinstalled apk to mobile.
However, the behavior is still inexact.
I paste the output from adb shell dumpsys alarm
below:
RTC_WAKEUP #0: Alarm{426941b0 type 0 net.coolbie.alarmclock}
type=0 when=+4m46s480ms repeatInterval=0 count=0
operation=PendingIntent{42553668: PendingIntentRecord{42a6cc38 net.coolbie.alarmclock broadcastIntent}}
You can see "when" is +4m up there, but which triggerTime is just 8 seconds.
long triggerTime = calendar.getTimeInMillis();
long currentTime = System.currentTimeMillis();
Toast.makeText(mContext, "gap is:"+(triggerTime-currentTime)/1000,Toast.LENGTH_LONG).show();
Intent intent = new Intent(mContext.getApplicationContext(), AlarmReceiver.class);
PendingIntent pendIntent = PendingIntent.getBroadcast(mContext.getApplicationContext(),
0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
mAlarmManager.set(AlarmManager.RTC_WAKEUP, triggerTime, pendIntent);