Last active
May 7, 2019 16:00
-
-
Save adriantache/6f30ea5a8a718b11d9d9150b30b38e01 to your computer and use it in GitHub Desktop.
Worker Custom Class
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 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