I have a calendar app which need to display Current Date and time and Events(Holidays) in the notification bar of a country(i.e India) even when app is closed or in Background. I made customized notification bar and implemented using remote views. I used broadcast receiver and foreground service to implement these functions. But i got too many problems.
- Notification disappears randomly in a day or two.
- android.app.RemoteServiceException crash
- android.app.ForegroundServiceStartNotAllowedException
- Context.startForegroundService() did not then call Service.startForeground()
etc. Android introduces new features such as work manager instead of using foreground service however they do not allow updating every minute. But i need to show hour and minute and update it every minute. As of end of 2023 which technologies (Alarm Manager, Broadcast Receiver, BOOT_COMPLETED, ACTION_TICK, DATE_CHANGED, WorkManager, Handler, Timer etc) should i use to make an app ANR and crash free. I have attached image for better understanding. Please Help. 