use of android.app.AlarmManager in project cw-advandroid by commonsguy.
the class OnBootReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, OnAlarmReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 60000, PERIOD, pi);
}
use of android.app.AlarmManager in project AisenWeiBo by wangdan.
the class UnreadService method clearAlarm.
private static void clearAlarm() {
Logger.v(TAG, "clear unread block");
AlarmManager am = (AlarmManager) GlobalContext.getInstance().getSystemService(ALARM_SERVICE);
am.cancel(getOperation());
}
use of android.app.AlarmManager in project AisenWeiBo by wangdan.
the class UnreadService method resetTheTime.
private void resetTheTime() {
Logger.v(TAG, "reset unread block");
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
// 指定时间
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, AppSettings.getUnreadInterval());
Logger.v(TAG, String.format("未读消息,在%s后还是读取", AppSettings.getUnreadInterval()));
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), getOperation());
}
use of android.app.AlarmManager in project Conversations by siacs.
the class XmppConnectionService method scheduleNextIdlePing.
@TargetApi(Build.VERSION_CODES.M)
private void scheduleNextIdlePing() {
Log.d(Config.LOGTAG, "schedule next idle ping");
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(this, EventReceiver.class);
intent.setAction(ACTION_IDLE_PING);
alarmManager.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + (Config.IDLE_PING_INTERVAL * 1000), PendingIntent.getBroadcast(this, 0, intent, 0));
}
use of android.app.AlarmManager in project muzei by romannurik.
the class MuzeiArtSource method setUpdateAlarm.
private void setUpdateAlarm(long nextTimeMillis) {
if (!isEnabled()) {
Log.w(TAG, "Source has no subscribers, not actually scheduling next update" + ", id=" + mName);
return;
}
if (nextTimeMillis < System.currentTimeMillis()) {
Log.w(TAG, "Refusing to schedule next artwork in the past, id=" + mName);
return;
}
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC, nextTimeMillis, getHandleNextCommandPendingIntent(this));
Log.i(TAG, "Scheduling next artwork (source " + mName + ") at " + new Date(nextTimeMillis));
}
Aggregations