Given
- Target OS versions: 4.4 – 10;
- App meant to be published in Google Play;
- App idea is public transport tracking (notifying when the specific bus is about to arrive to specific bus stop).
Problem
I was working on implementing notifications that will be displayed after app is closed/killed, facing some issues earlier. But, then, when I found solution, all works fine. I thought it did.
I have been testing notifications again, and noticed, that, after app closing or killing, notifications are appeared but only during 1-2 minutes after closing/killing. Then noting is working (I also tested toast, etc.)
I started googling, and read about Doze (I am testing on Android 8.1). I went to settings and turned off battery optimization for my app. Now notifications are displayed and after 1-2 minutes, all is working.
Question
At the same time Telegram, Instagram and others apps that always display notifications, after 1 minute or 1 hour, are battery optimized.
How do they display notification in Doze?
I read about Firebase. I hope this is not the only one solution. And currently, I even didn’t understand how it can help, but even, if can, if it is the only solution it is very stupid.