Closed eidolonFIRE closed 1 month ago
Android 14 added a permission for posting notifications.
android.permission.POST_NOTIFICATIONS
Adding (and granting) this shows the notification again.
Unfortunately geolocator needs permission s (plural) that are not mentioned in its documentation. You have to do a bit research/trial-and-error to find all necessary permission.
I did try adding both
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
but didn't work. Maybe post_notif wasn't granted properly. I'll mess with it some more and post back.
android.permission.POST_NOTIFICATIONS
is a runtime permissions that must be granted by the user. Either request it with permission_handler
or manually in the settings (android system settings app).
Now that I don't write from mobile, I can copy the permissions I currently request for geolocator (mabye there are more missing):
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- runtime -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- runtime -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <!-- runtime -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
Confirmed that using permission_handler to request notification permission fixed it 👍 cheers.
Is there an existing issue for this?
Please select affected platform(s)
Old behavior
In previous android versions, setting up the
ForegroundNotificationConfig
would push a persistent notification linked to the app.Current behavior
The foreground service for location still works even while phone is locked, but there's no notification to indicate so.
Steps to reproduce
-
Code sample
Code sample
```dart [Paste your code here] ```Screenshots or video
Screenshots or video demonstration
[Upload media here]Current version
12.0.0
Last version without regression
?