Created
April 17, 2015 13:11
-
-
Save kmdupr33/4c90e155dcaf6c4e0147 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
@Override | |
public void onStop() { | |
super.onStop(); | |
if (mInitStarred != mStarred) { | |
if (UIUtils.getCurrentTime(this) < mSessionStart) { | |
// Update Calendar event through the Calendar API on Android 4.0 or new versions. | |
Intent intent = null; | |
if (mStarred) { | |
// Set up intent to add session to Calendar, if it doesn't exist already. | |
intent = new Intent(SessionCalendarService.ACTION_ADD_SESSION_CALENDAR, | |
mSessionUri); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_START, | |
mSessionStart); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_END, | |
mSessionEnd); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_ROOM, mRoomName); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_TITLE, mTitleString); | |
} else { | |
// Set up intent to remove session from Calendar, if exists. | |
intent = new Intent(SessionCalendarService.ACTION_REMOVE_SESSION_CALENDAR, | |
mSessionUri); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_START, | |
mSessionStart); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_END, | |
mSessionEnd); | |
intent.putExtra(SessionCalendarService.EXTRA_SESSION_TITLE, mTitleString); | |
} | |
intent.setClass(this, SessionCalendarService.class); | |
startService(intent); | |
if (mStarred) { | |
setupNotification(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment