notifee
notifee copied to clipboard
Document Android 14 behavior changes for foreground services
https://developer.android.com/about/versions/14/changes/fgs-types-required#permission-for-fgs-type
Types are now required for Android 14, and their associated permissions need to be declared.
Indeed - related is the new full screen intent item
notifee.displayNotification cause crash on Android 14 when passing prop android: {asForegroundService : true}
Update: Miss configuration in AndroidManifest cause this crash.
Declare service type on manifest to prevent the crash
<service android:name="app.notifee.core.ForegroundService" android:foregroundServiceType="location|camera|microphone" />
As well as the foreground service permission, from May 2024 apps targeting API level 34+ apparently need to handle the fullscreen intent permission differently?
For apps targeting Android U (API Level 34) and above, USE_FULL_SCREEN_INTENT is now a special app permission granted automatically only to apps whose core functionality requires a full screen notification.
From: https://developer.android.com/distribute/play-policies
this is possibliiy solution
For anyone with this issue while we wait for the docs to be updated, you need to first add this to your manifest as pointed out above
<service android:name="app.notifee.core.ForegroundService" android:foregroundServiceType="location|camera|microphone" />
Then add a further permission based on the foregroundServiceType
chosen, for dataSync
I had to add <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
More info here:
https://developer.android.com/about/versions/14/changes/fgs-types-required
From the android docs
If the foreground service needs new permissions after you launch it, you should call startForeground() again and add the new service types. For example, suppose a fitness app runs a running-tracker service that always needs location information, but might or might not need media permissions. You would need to declare both location and mediaPlayback in the manifest. If a user starts a run and just wants their location tracked, your app should call startForeground() and pass just the location service type. Then, if the user wants to start playing audio, call startForeground() again and pass location|mediaPlayback.
We would actually need support to set foreground service types dynamically,
for example, sometimes location permission may have not been granted and we would still need to start the service
In my view, notifee.displayNotification
should support specifying the type "location|camera|microphone"
for example.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Indeed - related is the new full screen intent item
do we need this permission for notifee even? Play console only allows it for alarm apps (which ours clearly isn't but it schedules local notifications that need to be delivered with high timely accuracy)
AndroidManifest.xml
<manifest ...>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
<application
...
<service
android:name="app.notifee.core.ForegroundService"
android:foregroundServiceType="dataSync"
/>
</application>
</manifest>