Closed JVeverGiveUp closed 1 year ago
Hi @JVeverGiveUp, 👋
This is Android 14 new requirements and you can fix it by adding the following lines to your AndroidManifest.xml
file:
add permission <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
include android:foregroundServiceType="specialUse"
inside service block, like this
<service
android:name=".MyServiceKt"
+ android:foregroundServiceType="specialUse"
>
+ <property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="foo"/> <!-- optional -->
</service>
You can find more permissions, use cases HERE.
If this response does not satisfy you, please don't hesitate to re-open the issue, Thank you. 💖
Thank you very much for your explain. It is really helpful!
If an app using your library, and target Android 34 will lead to android.app.MissingForegroundServiceTypeException: Starting FGS without a type . It seem to be target android 34 will need to specific type of foreground in startForeground (which your library use for notification) Details: Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type callerApp=ProcessRecord{41f6370 } targetSDK=34 at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53) at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49) at android.os.Parcel.readParcelableInternal(Parcel.java:4870) at android.os.Parcel.readParcelable(Parcel.java:4852) at android.os.Parcel.createExceptionOrNull(Parcel.java:3052) at android.os.Parcel.createException(Parcel.java:3041) at android.os.Parcel.readException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:2966) at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6761) at android.app.Service.startForeground(Service.java:775) at com.torrydo.floatingbubbleview.FloatingBubbleService.notify(FloatingBubbleService.kt:233) at com.torrydo.floatingbubbleview.FloatingBubbleService.onCreate(FloatingBubbleService.kt:67)