When a service is started with startForegroundService, the service class also has to execute a startForeground. If the service class does not do this, there will be a RemoteServiceException, such as
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
My question is, how can I catch this exception? I tried placing the try/catch statement around the startForeground command, but that didn’t catch the exception. Any thoughts?