The problem is that you're using incompatible clocks. You should either use AlarmManager.ELAPSED_REALTIME_WAKEUP
together with System.elapsedRealtime()
, or AlarmManager.RTC_WAKEUP
together with System.currentTimeMillis()
. For example:
getAccelData.setInexactRepeating(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis(), sampling_acc_ms, getValues);