Open wellbranding opened 4 years ago
It's problem of Chinese ROMs actually. If you go to the app settings and turn off background restrictions and set autostart ON and remove other restrictions too it'll surely work. I'm also using Xiaomi Phone and tested on it. Try it and LMK if it works
Actually it did not helped for all devices. It worked on Pixel 3 XL, but it does not work on Nexus 6P Emulator. Here is what I did:
The only solution which actually works is to start foreground service. If I am correct indeed I would like Firebase team to adress this issue and perhaps think of better solution, possibly create delayed notifications in the cloud.
Foreground service will also not work once it's removed or swiped out. Right?
Here's Autostart permission and turn off batter saving.
Yes, foreground service will not work if user disables it. Thanks, I think we are getting closer! However, I can't find this exact menu like in the screenshot on Nexus 6P (API 29). I long press on application and then press App Info, and advanced. How did you find this menu or is it Xiaomi specific ?
I checked on my Xioami MI A2 (API 29, Android P) and could not find this menu.
Yeah it's Xiaomi specific
On Sat 13 Jun, 2020, 9:08 PM Viktor Vostrikov, notifications@github.com wrote:
Yes, foreground service will not work if user disables it. Thanks, I think we are getting closer! However, I can't find this exact menu like in the screenshot on Nexus 6P. I long press on application and then press App Info, and advanced. How did you find this menu or is it Xiaomi specific ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PatilShreyas/FCM-OnDeviceNotificationScheduler/issues/6#issuecomment-643639828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVWFOENIQF2633ZN2U4AXTRWOMQNANCNFSM4N3OLL5A .
I updated my question with Xiaomi MI A2 screenshot. However it is stock android, so it does not use MIU... Still it does not work on Stock android as well as NEXUS 6P. You can test yourself :)
I found exact issue on Reddit. Seems that the only solution as I said is Foreground service, which is a hack and could be disabled...
Okay. Thanks for sharing this. I'll surely look into it.
On Sat 13 Jun, 2020, 9:19 PM Viktor Vostrikov, notifications@github.com wrote:
I found exact issue on Reddit: https://www.reddit.com/r/androiddev/comments/gepps0/pendingintent_and_alarmmanager_dont_work_when_the/ http://url Seems that the only solution as I said is Foreground service, which is a hack and could be disabled...
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PatilShreyas/FCM-OnDeviceNotificationScheduler/issues/6#issuecomment-643641175, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVWFOGGA3B3TETVHO3HZ4TRWONYVANCNFSM4N3OLL5A .
@PatilShreyas Any news? This is critical for our implementation. I have checked and OneSignal offers solution with scheduled notifications. Is there alternative with FCM without any hacky solution? :)
Yes. You can use Firebase Cloud Function with Cron jobs which will automatically execute on specified time and date (or periodic) which will send FCM message.
See resources below:
Thanks, I looked at them. They seem more like a cron job for period requests. Can I declare specific date for creating a notification? If yes, what should I pass as parameter in functions.pubsub.schedule()?
Also, if I need to create 3 notifications at random dates every day, I would need to create a 3 different pub sub requests?
I personally didn't try it so can't give you a satisfactory solution. I think you should ask a question on StackOverflow or write a tweet by tagging Firebase.
Hello, I have tried using alarManager.set, but it does not work with all devices, particularly with Huawei or Xiaomi. I tried to use setExactAndAllowWhileIdle, but it also does not work if app is closed. What are your suggestions? Will you update your sample to tackle these issues?