Last active
December 14, 2019 07:07
-
-
Save PatilShreyas/ecac4c19a25348f2d8a5c234e82be550 to your computer and use it in GitHub Desktop.
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
| class ScheduledWorker(appContext: Context, workerParams: WorkerParameters) : | |
| Worker(appContext, workerParams) { | |
| override fun doWork(): Result { | |
| Log.d(TAG, "Work START") | |
| // Get Notification Data | |
| val title = inputData.getString(NOTIFICATION_TITLE) | |
| val message = inputData.getString(NOTIFICATION_MESSAGE) | |
| // Show Notification | |
| NotificationUtil(applicationContext).showNotification(title!!, message!!) | |
| // TODO Do your other Background Processing | |
| Log.d(TAG, "Work DONE") | |
| // Return result | |
| return Result.success() | |
| } | |
| companion object { | |
| private const val TAG = "ScheduledWorker" | |
| const val NOTIFICATION_TITLE = "notification_title" | |
| const val NOTIFICATION_MESSAGE = "notification_message" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment