Commit fbaaf157 authored by Vojtěch Hořánek's avatar Vojtěch Hořánek
Browse files

maybe fixed boot? seems to work

1 merge request!23First release candidat
Showing with 7 additions and 5 deletions
+7 -5
......@@ -43,9 +43,11 @@
<receiver android:name=".receiver.ConfirmReceiver" />
<receiver
android:name=".receiver.BootReceiver"
android:exported="true"
android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
......
package eu.vojtechh.takeyourpill.receiver
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
......@@ -17,12 +18,11 @@ class BootReceiver : BroadcastReceiver() {
@Inject
lateinit var pillRepository: PillRepository
@SuppressLint("UnsafeProtectedBroadcastReceiver")
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == "android.intent.action.BOOT_COMPLETED") {
goAsync(GlobalScope, Dispatchers.IO) {
pillRepository.getAllPills().forEach {
ReminderManager.planNextPillReminder(context, it)
}
goAsync(GlobalScope, Dispatchers.IO) {
pillRepository.getAllPills().forEach {
ReminderManager.planNextPillReminder(context, it)
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment