Android Open Source - SoundScheduler Boot Complete Receiver






From Project

Back to project page SoundScheduler.

License

The source code is released under:

GNU General Public License

If you think the Android project SoundScheduler listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Sound Scheduler//from w w  w  .ja  v  a2 s .com
 * Copyright (C) 2013 Victor Kifer
 */

package com.victorkifer.SoundScheduler.receivers;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.*;
import android.os.SystemClock;
import android.util.Log;

public class BootCompleteReceiver extends BroadcastReceiver {
    private static final String TAG = BootCompleteReceiver.class.getSimpleName();

    private static final int MINUTE = 60*1000;

    @Override
    public void onReceive(Context context, Intent intent) {

        Log.d(TAG, "Registering receiver");
        createAlarmBasedReceiver(context);
    }

    public static void createAlarmBasedReceiver(Context context) {
        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);

        PendingIntent pi = PendingIntent.getBroadcast(context.getApplicationContext(),
                0,
                new Intent(TimeChangeReceiver.ACTION_ALARM_CALL),
                0);

        alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,
                (SystemClock.elapsedRealtime() / MINUTE)*MINUTE + MINUTE,
                MINUTE,
                pi);
    }
}




Java Source Code List

com.victorkifer.SoundScheduler.AboutActivity.java
com.victorkifer.SoundScheduler.EditRuleActivity.java
com.victorkifer.SoundScheduler.MainActivity.java
com.victorkifer.SoundScheduler.adapters.RuleListAdapter.java
com.victorkifer.SoundScheduler.database.RulesDataSource.java
com.victorkifer.SoundScheduler.database.RulesDatabaseHelper.java
com.victorkifer.SoundScheduler.entities.Rule.java
com.victorkifer.SoundScheduler.listeners.RuleDeleteListener.java
com.victorkifer.SoundScheduler.listeners.RuleItemStateListener.java
com.victorkifer.SoundScheduler.managers.SoundManager.java
com.victorkifer.SoundScheduler.receivers.BootCompleteReceiver.java
com.victorkifer.SoundScheduler.receivers.TimeChangeReceiver.java