I have encountered huge amount of exceptions reported from Playstore. RemoteServiceException from Android P.
I am creating android foreground service and then calling startForegound(with channel).
But 99.9% only 9.0(android P) users report RemoteServiceException. I checked whether i make notification channel for the service. I also checked whether i call startForegroundService for os after OREO.
Every code had no problem.
But i found that i am calling startForegroundService() multiple times, and but onCreate() of Service called only once at the first time when it is created. So startForeground() inside of onCreate() is called only once.
But if i put startForeground() in the onStartCommand(), then it will also called as many times as i call startForegroundService(). Because it will be also called whenever you call startService/startForegroundService (even though the instance of Service is already made).
Do you think it is the cause of the Exception.
And mboy's comment of https://stackoverflow.com/a/51251741/5343 also says similar things.