RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() In Android 14

276 Views Asked by At
Fatal Exception: android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException
Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{d25c3d9 u0 com.package/.widgets.MyService}

Getting above crash in widget specially in Android 14 version.

Also Added foreground service in AndroidManifest.xml file

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> 
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />


<service
    android:name=".widgets.WidgetService"
    android:foregroundServiceType="specialUse"
    android:exported="false"
    android:permission="android.permission.BIND_REMOTEVIEWS" />

Follow all step given in official document https://developer.android.com/about/versions/14/behavior-changes-14#java

0

There are 0 best solutions below