Skip to content

Instantly share code, notes, and snippets.

@adriantache
Last active May 7, 2019 16:00
Show Gist options
  • Save adriantache/6f30ea5a8a718b11d9d9150b30b38e01 to your computer and use it in GitHub Desktop.
Save adriantache/6f30ea5a8a718b11d9d9150b30b38e01 to your computer and use it in GitHub Desktop.
Worker Custom Class
public class NotifyWorker extends Worker {
public NotifyWorker(@NonNull Context context, @NonNull WorkerParameters params) {
super(context, params);
}
@NonNull
@Override
public Result doWork() {
// Method to trigger an instant notification
triggerNotification();
return Result.success();
// (Returning RETRY tells WorkManager to try this task again
// later; FAILURE says not to try again.)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment