本文整理了Java中android.app.AlarmManager.setAndAllowWhileIdle()
方法的一些代码示例,展示了AlarmManager.setAndAllowWhileIdle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlarmManager.setAndAllowWhileIdle()
方法的具体详情如下:
包路径:android.app.AlarmManager
类名称:AlarmManager
方法名:setAndAllowWhileIdle
暂无
代码示例来源:origin: k9mail/k-9
@RequiresApi(Build.VERSION_CODES.M)
private void setAndAllowWhileIdle(int type, long triggerAtMillis, PendingIntent operation) {
alarmManager.setAndAllowWhileIdle(type, triggerAtMillis, operation);
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(minSdk = M)
public void setAndAllowWhileIdle_shouldRegisterAlarm() {
assertThat(shadowAlarmManager.getNextScheduledAlarm()).isNull();
alarmManager.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME, 0,
PendingIntent.getActivity(activity, 0, new Intent(activity, activity.getClass()), 0));
assertThat(shadowAlarmManager.getNextScheduledAlarm()).isNotNull();
}
代码示例来源:origin: k9mail/k-9
@Test
public void set_withDozeSupportAndWhiteListed_shouldCallSetAndAllowWhileIdleOnAlarmManager() throws Exception {
configureDozeSupport(true);
addAppToBatteryOptimizationWhitelist();
alarmManager.set(TIMER_TYPE, TIMEOUT, PENDING_INTENT);
verify(systemAlarmManager).setAndAllowWhileIdle(TIMER_TYPE, TIMEOUT, PENDING_INTENT);
}
代码示例来源:origin: stackoverflow.com
alarm.setAndAllowWhileIdle(
alarm.RTC_WAKEUP,
System.currentTimeMillis() + (1000 * 60 * updateVal),
代码示例来源:origin: antest1/kcanotify
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "Received " + intent);
Util.logExtras(intent);
// Check if rules needs to be reloaded
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(KcaVpnService.this);
int delay = Integer.parseInt(prefs.getString("screen_delay", "0"));
boolean interactive = Intent.ACTION_SCREEN_ON.equals(intent.getAction());
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_SCREEN_OFF_DELAYED), PendingIntent.FLAG_UPDATE_CURRENT);
am.cancel(pi);
if (interactive || delay == 0) {
last_interactive = interactive;
reload("interactive state changed", KcaVpnService.this);
} else {
if (ACTION_SCREEN_OFF_DELAYED.equals(intent.getAction())) {
last_interactive = interactive;
reload("interactive state changed", KcaVpnService.this);
} else {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
am.set(AlarmManager.RTC_WAKEUP, new Date().getTime() + delay * 60 * 1000L, pi);
else
am.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, new Date().getTime() + delay * 60 * 1000L, pi);
}
}
}
};
代码示例来源:origin: matrix-org/matrix-android-sdk
mAlarmManager.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, futureInMillis, mPendingDelayedIntent);
} else {
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, futureInMillis, mPendingDelayedIntent);
内容来源于网络,如有侵权,请联系作者删除!