Last active
February 13, 2016 00:38
-
-
Save happasuke/8f2ede46abd9154109d8 to your computer and use it in GitHub Desktop.
This file contains 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 void setAlarm() { | |
Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class); | |
mSender = PendingIntent.getBroadcast(getApplicationContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); | |
Calendar calendar = Calendar.getInstance(); | |
calendar.setTimeInMillis(System.currentTimeMillis()); | |
calendar.add(Calendar.SECOND, 10); | |
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); | |
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), mSender); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment