List of usage examples for android.app AlarmManager ELAPSED_REALTIME_WAKEUP
int ELAPSED_REALTIME_WAKEUP
To view the source code for android.app AlarmManager ELAPSED_REALTIME_WAKEUP.
Click Source Link
From source file:myblog.richard.vewe.launcher3.LauncherApplication.java
public void restart() { if (mIntent != null) { AlarmManager alarmManager;/*from ww w . j a v a 2 s . c o m*/ alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, 15000, mIntent); System.exit(2); } }
From source file:com.jerrellmardis.amphitheatre.util.Utils.java
public static void scheduleLibraryUpdateService(Context context) { Log.d("amp:Utils", "Checking if alarm is already set: " + isAlarmAlreadySet(context, LibraryUpdateService.class)); //And now//w w w. j av a2 s.co m Log.d("amp:Utils", "Start rechecking the library"); Intent intent = new Intent(context, LibraryUpdateService.class); intent.putExtra("ALARM", true); /*context.startService(intent);*/ if (isAlarmAlreadySet(context, LibraryUpdateService.class)) return; AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); //Intent intent = ... PendingIntent alarmIntent = PendingIntent.getService(context, LIBRARY_UPDATE_REQUEST_CODE, intent, 0); alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, AlarmManager.INTERVAL_HALF_HOUR, AlarmManager.INTERVAL_HOUR * 3, //Every three hours seems sufficient alarmIntent); }
From source file:be.benvd.mvforandroid.data.MVDataService.java
/** * Schedules the next execution of doWakefulWork, using the frequency * specified in the Preferences.//from w w w. j a v a 2 s. com */ private void scheduleNextUpdate() { long delay = Long.parseLong(prefs.getString("update_frequency", "86400000")); alarm.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + delay, wakefulWorkIntent); Log.v(MVDataService.class.getSimpleName(), "Update scheduled in " + delay + "ms"); }
From source file:org.wso2.emm.agent.services.DeviceStartupIntentReceiver.java
/** * Initiates device notifier on device startup. * @param context - Application context. *///w ww .j a va2s.co m private void setRecurringAlarm(Context context) { this.resources = context.getApplicationContext().getResources(); String mode = Preference.getString(context, Constants.PreferenceFlag.NOTIFIER_TYPE); boolean isLocked = Preference.getBoolean(context, Constants.IS_LOCKED); String lockMessage = Preference.getString(context, Constants.LOCK_MESSAGE); if (lockMessage == null || lockMessage.isEmpty()) { lockMessage = resources.getString(R.string.txt_lock_activity); } if (isLocked) { Operation lockOperation = new Operation(); lockOperation.setId(DEFAULT_ID); lockOperation.setCode(Constants.Operation.DEVICE_LOCK); try { JSONObject payload = new JSONObject(); payload.put(Constants.ADMIN_MESSAGE, lockMessage); payload.put(Constants.IS_HARD_LOCK_ENABLED, true); lockOperation.setPayLoad(payload.toString()); OperationProcessor operationProcessor = new OperationProcessor(context); operationProcessor.doTask(lockOperation); } catch (AndroidAgentException e) { Log.e(TAG, "Error occurred while executing hard lock operation at the device startup"); } catch (JSONException e) { Log.e(TAG, "Error occurred while building hard lock operation payload"); } } int interval = Preference.getInt(context, context.getResources().getString(R.string.shared_pref_frequency)); if (interval == DEFAULT_INDEX) { interval = DEFAULT_INTERVAL; } if (mode == null) { mode = Constants.NOTIFIER_LOCAL; } if (Preference.getBoolean(context, Constants.PreferenceFlag.REGISTERED) && Constants.NOTIFIER_LOCAL.equals(mode.trim().toUpperCase(Locale.ENGLISH))) { long startTime = DEFAULT_TIME_MILLISECONDS; Intent alarmIntent = new Intent(context, AlarmReceiver.class); PendingIntent recurringAlarmIntent = PendingIntent.getBroadcast(context, DEFAULT_REQUEST_CODE, alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, startTime, interval, recurringAlarmIntent); Log.d(TAG, "Setting up alarm manager for polling every " + interval + " milliseconds."); } }
From source file:com.jigarmjoshi.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (SimpleDatabaseUtil.isFirstApplicationStart(this)) { Log.i(MainActivity.class.getSimpleName(), "creating database for the first time"); SQLiteSimple databaseSimple = new SQLiteSimple(this, DATABASE_VERSION); databaseSimple.create(Report.class, LastLocation.class); } else if (SimpleDatabaseUtil.isFirstStartOnAppVersion(this, DATABASE_VERSION)) { Log.i(MainActivity.class.getSimpleName(), "creating database for the first time for this version " + DATABASE_VERSION); SQLiteSimple databaseSimple = new SQLiteSimple(this, DATABASE_VERSION); databaseSimple.create(Report.class, LastLocation.class); }//from w w w . ja va2 s.c om // initialize services EntryDao.getInstance(this); LastLocationDao.getInstance(this); // scheduler mgr = (AlarmManager) getSystemService(ALARM_SERVICE); Intent i = new Intent(this, LocationPoller.class); com.jigarmjoshi.service.LocationManager locationManager = com.jigarmjoshi.service.LocationManager .getInstance(getApplicationContext()); List<String> providers = locationManager.getAllProviders(); boolean fusedSupported = false; for (String provider : providers) { if (com.jigarmjoshi.service.LocationManager.FUSED_PROVIDER.equals(provider)) { fusedSupported = true; break; } } i.putExtra(LocationPoller.EXTRA_INTENT, new Intent(this, com.jigarmjoshi.reciever.LocationReceiver.class)); i.putExtra(LocationPoller.EXTRA_PROVIDER, (fusedSupported ? LocationManager.FUSED_PROVIDER : LocationManager.GPS_PROVIDER)); pi = PendingIntent.getBroadcast(this, 0, i, 0); mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 0, Long.parseLong(ConfigService.get(ConfigService.GPS_TASK_INTERVAL, "40000")), pi); // upload task Timer timer = new Timer(); TimerTask timerTask = new UploaderTask(this); timer.schedule(timerTask, 0, Long.parseLong(ConfigService.get(ConfigService.UPLOAD_TASK_INTERVAL, "40000"))); selectedTextView = new TextView(this); selectedTextView.setTextColor(Color.BLACK); selectedTextView.setGravity(Gravity.CENTER); selectedTextView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG); unSelectedTextView = new TextView(this); unSelectedTextView.setTextColor(Color.GRAY); unSelectedTextView.setGravity(Gravity.CENTER); unSelectedTextView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG); // create if first time getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#40808080"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#40808080"))); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs boolean first = false; for (String tab_name : tabs) { Tab tab = actionBar.newTab().setText(tab_name).setTabListener(this); if (first) { first = false; selectedTextView.setText(tab.getText().toString().toUpperCase(Locale.getDefault())); tab.setCustomView(selectedTextView); } else { unSelectedTextView.setText(tab.getText().toString().toUpperCase(Locale.getDefault())); tab.setCustomView(unSelectedTextView); } actionBar.addTab(tab); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); Toast.makeText(this, getString(R.string.wait_gps), Toast.LENGTH_LONG).show(); }
From source file:com.develop.autorus.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Fabric.with(this, new Crashlytics()); super.onCreate(savedInstanceState); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); AnalyticsApplication application = (AnalyticsApplication) getApplication(); mTracker = application.getDefaultTracker(); mTracker.setScreenName("Main activity"); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); if (pref.getBoolean("notificationIsActive", true)) { Intent checkIntent = new Intent(getApplicationContext(), MonitoringWork.class); Boolean alrarmIsActive = false; if (PendingIntent.getService(getApplicationContext(), 0, checkIntent, PendingIntent.FLAG_NO_CREATE) != null) alrarmIsActive = true;// ww w . j ava 2 s .com am = (AlarmManager) getSystemService(ALARM_SERVICE); if (!alrarmIsActive) { Intent serviceIntent = new Intent(getApplicationContext(), MonitoringWork.class); PendingIntent pIntent = PendingIntent.getService(getApplicationContext(), 0, serviceIntent, 0); int period = pref.getInt("numberOfActiveMonitors", 0) * 180000; if (period != 0) am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + period, period, pIntent); } } /*ForEasyDelete //Danger! Auchtung! ?, !!! String base64EncodedPublicKey = "<your license key here>";//? . !!! ? , // github ? . ?!!! mHelper = new IabHelper(this, base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Log.d(TAG, "In-app Billing setup failed: " + result); } else { Log.d(TAG, "In-app Billing is set up OK"); } } }); */ //Service inapp Intent intent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); intent.setPackage("com.android.vending"); blnBind = bindService(intent, mServiceConn, Context.BIND_AUTO_CREATE); String themeName = pref.getString("theme", "1"); if (themeName.equals("1")) { setTheme(R.style.AppTheme); if (android.os.Build.VERSION.SDK_INT >= 21) { Window statusBar = getWindow(); statusBar.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); statusBar.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); statusBar.setStatusBarColor(getResources().getColor(R.color.myPrimaryDarkColor)); } } else if (themeName.equals("2")) { setTheme(R.style.AppTheme2); if (android.os.Build.VERSION.SDK_INT >= 21) { Window statusBar = getWindow(); statusBar.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); statusBar.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); statusBar.setStatusBarColor(getResources().getColor(R.color.myPrimaryDarkColor2)); } } ThemeManager.init(this, 2, 0, null); if (isFirstLaunch) { SQLiteDatabase db = new DbHelper(this).getWritableDatabase(); Cursor cursorMonitors = db.query("monitors", null, null, null, null, null, null); Boolean monitorsExist = cursorMonitors != null && cursorMonitors.getCount() > 0; db.close(); if (getSupportFragmentManager().findFragmentByTag("MAIN") == null) { FragmentTransaction fTrans = getSupportFragmentManager().beginTransaction(); if (monitorsExist) mainFragment = SearchAndMonitorsFragment.newInstance(0); else mainFragment = SearchAndMonitorsFragment.newInstance(1); fTrans.add(R.id.container, mainFragment, "MAIN").commit(); } else { mainFragment = (SearchAndMonitorsFragment) getSupportFragmentManager().findFragmentByTag("MAIN"); if (getSupportFragmentManager().findFragmentByTag("Second") != null) { FragmentTransaction fTrans = getSupportFragmentManager().beginTransaction(); fTrans.remove(getSupportFragmentManager().findFragmentByTag("Second")).commit(); } pref.edit().remove("NumberOfCallingFragment"); } } backToast = Toast.makeText(this, "? ? ", Toast.LENGTH_SHORT); setContentView(R.layout.main_activity); mToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); mSnackBar = (SnackBar) findViewById(R.id.main_sn); setSupportActionBar(mToolbar); addMonitorButton = (Button) findViewById(R.id.toolbar_add_monitor_button); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.fragment_drawer); mNavigationDrawerFragment.setup(R.id.fragment_drawer, (DrawerLayout) findViewById(R.id.drawer), mToolbar); Thread threadAvito = new Thread(new Runnable() { @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void run() { Document doc; SharedPreferences sPref; try { String packageName = getApplicationContext().getPackageName(); doc = Jsoup.connect("https://play.google.com/store/apps/details?id=" + packageName).userAgent( "Mozilla/5.0 (Windows; U; WindowsNT 5.1; ru-RU; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6") .timeout(12000).get(); //"") PackageManager packageManager; PackageInfo packageInfo; packageManager = getPackageManager(); packageInfo = packageManager.getPackageInfo(getPackageName(), 0); Element mainElems = doc.select( "#body-content > div > div > div.main-content > div.details-wrapper.apps-secondary-color > div > div.details-section-contents > div:nth-child(4) > div.content") .first(); if (!packageInfo.versionName.equals(mainElems.text())) { sPref = getPreferences(MODE_PRIVATE); SharedPreferences.Editor ed = sPref.edit(); ed.putBoolean(SAVED_TEXT_WITH_VERSION, false); ed.commit(); } else { sPref = getPreferences(MODE_PRIVATE); SharedPreferences.Editor ed = sPref.edit(); ed.putBoolean(SAVED_TEXT_WITH_VERSION, true); ed.commit(); } //SharedPreferences sPrefRemind; //sPrefRemind = getPreferences(MODE_PRIVATE); //sPrefRemind.edit().putBoolean(DO_NOT_REMIND, false).commit(); } catch (HttpStatusException e) { return; } catch (IOException e) { return; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } }); SharedPreferences sPrefVersion; sPrefVersion = getPreferences(MODE_PRIVATE); Boolean isNewVersion; isNewVersion = sPrefVersion.getBoolean(SAVED_TEXT_WITH_VERSION, true); threadAvito.start(); boolean remind = true; if (!isNewVersion) { Log.d("affa", "isNewVersion= " + isNewVersion); SharedPreferences sPref12; sPref12 = getPreferences(MODE_PRIVATE); String isNewVersion12; PackageManager packageManager; PackageInfo packageInfo; packageManager = getPackageManager(); try { packageInfo = packageManager.getPackageInfo(getPackageName(), 0); isNewVersion12 = sPref12.getString("OldVersionName", packageInfo.versionName); if (!isNewVersion12.equals(packageInfo.versionName)) { SharedPreferences sPref; sPref = getPreferences(MODE_PRIVATE); SharedPreferences.Editor ed = sPref.edit(); ed.putBoolean(SAVED_TEXT_WITH_VERSION, false); ed.commit(); SharedPreferences sPrefRemind; sPrefRemind = getPreferences(MODE_PRIVATE); sPrefRemind.edit().putBoolean(DO_NOT_REMIND, false).commit(); } else remind = false; SharedPreferences sPrefRemind; sPrefRemind = getPreferences(MODE_PRIVATE); sPrefRemind.edit().putString("OldVersionName", packageInfo.versionName).commit(); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } SharedPreferences sPrefRemind; sPrefRemind = getPreferences(MODE_PRIVATE); Boolean dontRemind; dontRemind = sPrefRemind.getBoolean(DO_NOT_REMIND, false); Log.d("affa", "dontRemind= " + dontRemind.toString()); Log.d("affa", "remind= " + remind); Log.d("affa", "44444444444444444444444= "); if ((!dontRemind) && (!remind)) { Log.d("affa", "5555555555555555555555555= "); SimpleDialog.Builder builder = new SimpleDialog.Builder(R.style.SimpleDialogLight) { @Override public void onPositiveActionClicked(DialogFragment fragment) { super.onPositiveActionClicked(fragment); String packageName = getApplicationContext().getPackageName(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)); startActivity(intent); } @Override public void onNegativeActionClicked(DialogFragment fragment) { super.onNegativeActionClicked(fragment); } @Override public void onNeutralActionClicked(DialogFragment fragment) { super.onNegativeActionClicked(fragment); SharedPreferences sPrefRemind; sPrefRemind = getPreferences(MODE_PRIVATE); sPrefRemind.edit().putBoolean(DO_NOT_REMIND, true).commit(); } }; builder.message( " ?? ? ? ?") .title(" !").positiveAction("") .negativeAction("").neutralAction("? "); DialogFragment fragment = DialogFragment.newInstance(builder); fragment.show(getSupportFragmentManager(), null); } } }
From source file:com.rickendirk.rsgwijzigingen.ZoekService.java
private void setAlarmIn20Min() { Intent zoekIntent = new Intent(this, ZoekService.class); zoekIntent.putExtra("isAchtergrond", true); zoekIntent.addCategory("GeenWifiHerhaling"); //Categorie om andere intents cancelen te voorkomen PendingIntent pendingIntent = PendingIntent.getService(this, 3, zoekIntent, PendingIntent.FLAG_ONE_SHOT); AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Long in20Min = SystemClock.elapsedRealtime() + 1200000; //20Min in milisec. manager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, in20Min, pendingIntent); Log.i(TAG, "Nieuw alarm gezet in 20 min"); }
From source file:org.kegbot.app.service.CheckinService.java
private void registerAlarm() { unregisterAlarm();/*from ww w. j av a 2 s.c om*/ Log.d(TAG, "Registering alarm."); final Intent intent = getCheckinIntent(this); mPendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); final AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); final long nextCheckin = SystemClock.elapsedRealtime() + CHECKIN_INTERVAL_MILLIS; alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextCheckin, CHECKIN_INTERVAL_MILLIS, mPendingIntent); }
From source file:com.jerrellmardis.amphitheatre.util.Utils.java
public static void scheduleRecommendations(Context context) { Log.d("amp:Utils", "Checking if alarm is already set: " + isAlarmAlreadySet(context, RecommendationsService.class)); //And now//from w w w . ja v a 2 s . c om Log.d("amp:Utils", "Start rechecking the recommendations"); Intent intent = new Intent(context, RecommendationsService.class); intent.putExtra("ALARM", true); /*context.startService(intent);*/ if (isAlarmAlreadySet(context, RecommendationsService.class)) return; AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); //Intent intent = ... PendingIntent alarmIntent = PendingIntent.getService(context, LIBRARY_UPDATE_REQUEST_CODE, intent, 0); alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 5000, AlarmManager.INTERVAL_HALF_HOUR, //Every half hour seems sufficient alarmIntent); }
From source file:alaindc.crowdroid.SensorsIntentService.java
@Override protected void onHandleIntent(Intent intent) { if (intent != null) { final String action = intent.getAction(); if (action.equals(Constants.INTENT_START_SENSORS)) { // Init throughput taken SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(Constants.PREF_FILE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putBoolean(Constants.THROUGHPUT_TAKEN, false); editor.commit();/* w w w .j a v a 2 s . c o m*/ // Configure sensors and eventlistener mSensorManager = (SensorManager) getApplicationContext().getSystemService(Context.SENSOR_SERVICE); List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ALL); for (Sensor sensor : sensorList) { if (Constants.isInMonitoredSensors(sensor.getType())) mSensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL); } // TODO STUB: Comment this in release for (int type : Constants.STUBBED_MONITORED_SENSORS) { stub_onSensorChanged(type); } } if (action.equals(Constants.INTENT_START_AUDIOAMPLITUDE_SENSE)) { // Configure amplitude and start TEST amplitudeTask = new GetAmplitudeTask(this); amplitudeTask.getData(); } if (action.equals(Constants.INTENT_STUB_SENSOR_CHANGED + Sensor.TYPE_AMBIENT_TEMPERATURE)) { stub_onSensorChanged(intent.getIntExtra(Constants.INTENT_STUB_SENSOR_CHANGED_TYPE, -1)); } if (action.equals(Constants.INTENT_STUB_SENSOR_CHANGED + Sensor.TYPE_PRESSURE)) { stub_onSensorChanged(intent.getIntExtra(Constants.INTENT_STUB_SENSOR_CHANGED_TYPE, -1)); } if (action.equals(Constants.INTENT_STUB_SENSOR_CHANGED + Sensor.TYPE_RELATIVE_HUMIDITY)) { stub_onSensorChanged(intent.getIntExtra(Constants.INTENT_STUB_SENSOR_CHANGED_TYPE, -1)); } if (action.equals(Constants.INTENT_RECEIVED_AMPLITUDE)) { double amplitude = intent.getDoubleExtra(Constants.EXTRA_AMPLITUDE, -1); if (amplitude > 0) { SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(Constants.PREF_FILE, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString(Constants.PREF_SENSOR_ + Constants.TYPE_AMPLITUDE, Double.toString(amplitude)); editor.commit(); // Update view Intent senseintent = new Intent(Constants.INTENT_UPDATE_SENSORS); senseintent.putExtra(Constants.INTENT_RECEIVED_DATA_EXTRA_DATA, "Sensor " + Constants.getNameOfSensor(Constants.TYPE_AMPLITUDE) + " value: " + Double.toString(amplitude)); LocalBroadcastManager.getInstance(this).sendBroadcast(senseintent); } int index = Constants.getIndexAlarmForSensor(Constants.TYPE_AMPLITUDE); // Set the alarms for next sensing of amplitude alarmMgr = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE); Intent intentAlarm = new Intent(getApplicationContext(), SensorsIntentService.class); intentAlarm.setAction(Constants.INTENT_START_AUDIOAMPLITUDE_SENSE); alarmIntent = PendingIntent.getService(getApplicationContext(), 0, intentAlarm, 0); // TIMEOUT for another monitoring of audio int seconds = 30; // TODO: De-hardcode this alarmMgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + seconds * 1000, alarmIntent); } } }