use of android.app.AlarmManager in project android_packages_apps_Settings by LineageOS.
the class ZonePicker method onListItemClick.
@Override
public void onListItemClick(ListView listView, View v, int position, long id) {
// Ignore extra clicks
if (!isResumed())
return;
final Map<?, ?> map = (Map<?, ?>) listView.getItemAtPosition(position);
final String tzId = (String) map.get(ZoneGetter.KEY_ID);
// Update the system timezone value
final Activity activity = getActivity();
final AlarmManager alarm = (AlarmManager) activity.getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone(tzId);
getActivity().onBackPressed();
}
use of android.app.AlarmManager in project run-wallet-android by runplay.
the class AppService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
if (SERVICE == null) {
SERVICE = this;
ensureStartups(getBaseContext());
TorHelper.init(this, null);
Intent service = new Intent(this, OnAlarmReceiver.class);
PendingIntent pintent = PendingIntent.getService(this, 0, service, 0);
AlarmManager alarm = (AlarmManager) this.getSystemService(Service.ALARM_SERVICE);
// Start every 30 seconds
alarm.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), Cal.HOURS_1_IN_MILLIS, pintent);
IntentFilter afilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
areceiver = new OnAlarmReceiver();
// IntentFilter aofilter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
// aoreceiver = new OnAlarmReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_BOOT_COMPLETED);
receiver = new OnBootReceiver();
IntentFilter bfilter = new IntentFilter("android.intent.action.QUICKBOOT_POWERON");
breceiver = new OnBootReceiver();
IntentFilter ubfilter = new IntentFilter(Intent.ACTION_USER_PRESENT);
ubreceiver = new OnUserPresentReceiver();
registerReceiver(areceiver, afilter);
// registerReceiver(aoreceiver, aofilter);
registerReceiver(receiver, filter);
registerReceiver(breceiver, bfilter);
registerReceiver(ubreceiver, ubfilter);
// removed for now, will be coming back with future Friend transfers feature
// ContactsObserver contentObserver = new ContactsObserver();
// this.getContentResolver().registerContentObserver (ContactsContract.Contacts.CONTENT_URI, true, contentObserver);
startSyncsHandler.postDelayed(new Runnable() {
public void run() {
AppService.startRegularRefresh();
syncDataHandler.postDelayed(syncDataThread, 10000);
}
}, 2000);
}
// ensureForegroundService();
return START_STICKY;
}
use of android.app.AlarmManager in project vlc-android by videolan.
the class BootupReceiver method scheduleRecommendationUpdate.
private void scheduleRecommendationUpdate(Context context) {
AlarmManager alarmManager = (AlarmManager) context.getApplicationContext().getSystemService(Context.ALARM_SERVICE);
Intent recommendationIntent = new Intent(context, RecommendationsService.class);
PendingIntent alarmIntent = PendingIntent.getService(context, 0, recommendationIntent, 0);
alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, INITIAL_DELAY, AlarmManager.INTERVAL_HOUR, alarmIntent);
}
use of android.app.AlarmManager in project vlc-android by videolan.
the class AdvOptionsDialog method setSleep.
public static void setSleep(Calendar time) {
final AlarmManager alarmMgr = (AlarmManager) VLCApplication.getAppContext().getSystemService(Context.ALARM_SERVICE);
final Intent intent = new Intent(VLCApplication.SLEEP_INTENT);
final PendingIntent sleepPendingIntent = PendingIntent.getBroadcast(VLCApplication.getAppContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
if (time != null)
alarmMgr.set(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(), sleepPendingIntent);
else
alarmMgr.cancel(sleepPendingIntent);
VLCApplication.sPlayerSleepTime = time;
}
use of android.app.AlarmManager in project Slide by ccrama.
the class AutoCacheScheduler method cancel.
public void cancel(Context c) {
AlarmManager manager = (AlarmManager) c.getSystemService(Context.ALARM_SERVICE);
manager.cancel(pendingIntent);
}
Aggregations