Last active
August 22, 2017 19:29
-
-
Save yccheok/d39b434470a4135104efae76ec75afc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void startAlarmBroadcastReceiver(Context context, long delay) { | |
| Intent _intent = new Intent(context, AlarmBroadcastReceiver.class); | |
| PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, _intent, 0); | |
| AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); | |
| // Remove any previous pending intent. | |
| alarmManager.cancel(pendingIntent); | |
| alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + delay, pendingIntent); | |
| } | |
| public class AlarmBroadcastReceiver extends BroadcastReceiver { | |
| @Override | |
| public void onReceive(Context context, Intent intent) { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment