i have a use case:
we have information about user's medications like at what time ,what dose and what med,
we need to notify users that they have to take it.
currently, I have tried workmanager , gets killed if the app gets killed, I tried alarmManager , doesn't work in doze mode (high priority),
I have another solution ,I use our node.js server with nodecron to emit topics such as 1,2,12,4(the hour) , the client app checks if the user has any medication at x hour and it subscribes to x topic , then if we emit the fcm request for x topic when the hour is x , we will receive a notification.
but the latter one requires us to assume that the app is always connected to the internet.
we are building this app for a hackathon? what should I do?
should I consider a widget or something similar? please tell me possible solutions thanks
I tried alarmManager , doesn't work in doze mode (high priority),
According to the documentation of doze mode restrictions https://developer.android.com/training/monitoring-device-state/doze-standby#restrictions there is the possibility to fire up alarm while in doze:
If you need to set alarms that fire while in Doze, use setAndAllowWhileIdle() or setExactAndAllowWhileIdle().
this alarm will be allowed to execute even when the system is in low power idle (doze mode).
Why alarm manager doesn't fit your needs?
Also, for testing, I recommend you to setup adb
where you can easily put your device into idle mode:
adb shell dumpsys deviceidle force-idle
And exit idle mode like this:
adb shell dumpsys deviceidle unforce