Created
May 22, 2018 09:30
-
-
Save adriantache/e20d4a74c522e6cfa1f2f94b1f9e9153 to your computer and use it in GitHub Desktop.
Work Request
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
//we set a tag to be able to cancel all work of this type if needed | |
public static final String workTag = "notificationWork"; | |
//store DBEventID to pass it to the PendingIntent and open the appropriate event page on notification click | |
Data inputData = new Data.Builder().putInt(DBEventIDTag, DBEventID).build(); | |
// we then retrieve it inside the NotifyWorker with: | |
// final int DBEventID = getInputData().getInt(DBEventIDTag, ERROR_VALUE); | |
OneTimeWorkRequest notificationWork = new OneTimeWorkRequest.Builder(NotifyWorker.class) | |
.setInitialDelay(calculateDelay(event.getDate()), TimeUnit.MILLISECONDS) | |
.setInputData(inputData) | |
.addTag(workTag) | |
.build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment