Skip to content

Commit

Permalink
Created receiver when application is updated for rescheduling jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Javinator9889 committed Apr 21, 2020
1 parent 0e9e747 commit 050c835
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/src/main/AndroidManifest.xml
Expand Up @@ -58,7 +58,17 @@
android:exported="true">
</receiver>

<receiver android:name=".jobs.BootCompletedJob"
<receiver
android:name=".jobs.UpdateReceiver"
android:enabled="true">
<intent-filter>
<action
android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>

<receiver
android:name=".jobs.BootCompletedJob"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
Expand Down
@@ -0,0 +1,32 @@
/*
* Copyright © 2020 - present | Handwashing reminder by Javinator9889
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* Created by Javinator9889 on 21/04/20 - Handwashing reminder.
*/
package com.javinator9889.handwashingreminder.jobs

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.javinator9889.handwashingreminder.application.HandwashingApplication

class UpdateReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
with(HandwashingApplication.getInstance().workHandler) {
enqueuePeriodicNotificationsWorker(true)
}
}
}

0 comments on commit 050c835

Please sign in to comment.