flutter-geolocator
flutter-geolocator copied to clipboard
[Feature Request]: Add
Is there already an issue requesting this feature?
- [X] I have searched the existing issues.
Please select affected platform(s)
- [X] Android
- [ ] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
Use case
-
How can I change the channel name? I use different languages in the application, but here the channel name is automatically in English.
-
How to find out the channel id? So that I can force close the notification!
Proposal
It's probably worth adding a setting to add your created channel for the current notification
Specific requirements or considerations
No response
Additional information or context
geolocator: ^11.0.0
[✓] Flutter (Channel stable, 3.16.9, on Ubuntu 22.04.3 LTS 5.15.0-94-generic, locale ru_RU.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2023.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
[✓] Connected device (3 available)
[✓] Network resources
Dear @DmitriySimonov,
In order to help you, can you elaborate a bit on the subject? Can you for example share some of your code so that we can reproduce it? Can you also describe the steps to reproduce the case?
Kind regards,
Tim
Dear @DmitriySimonov,
In order to help you, can you elaborate a bit on the subject? Can you for example share some of your code so that we can reproduce it? Can you also describe the steps to reproduce the case?
Kind regards,
Tim
const LocationSettings locationSettings = LocationSettings(
accuracy: LocationAccuracy.bestForNavigation,
);
Stream<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings);
StreamSubscription<Position> positionStreamSubscription = _positionStream.listen((Position? position) async {
//...
});
But did you enter the label "Background location" somewhere?
Kind regards
But did you enter the label "Background location" somewhere?
Kind regards
No, it's a standardized creation
Hi @DmitriySimonov,
Unfortunately we are not to familiar with these settings and how Android adds them. However this seems to be related to the Android notification settings.
Please try to use the AndroidSettings class instead of the LocationSettings class and specify detailed information for the foregroundNotificationConfig field. Something a long the lines of the following code sample:
late LocationSettings locationSettings;
if (defaultTargetPlatform == TargetPlatform.android) {
locationSetting = AndroidSettings(
accuracy: LocationAccuracy.bestForNavigation,
foregroundNotificationConfig: const ForegroundNotificationConfig(
notificationText:
"Example app will continue to receive your location even when you aren't using it", // Translate this text into the appropriate language
notificationTitle: "Running in Background", // Translate this text into the appropriate language
enableWakeLock: true,
),
);
} else {
locationSettings = LocationSettings(
accuracy: LocationAccuracy.bestForNavigation,
);
}
Please let us know if this helps.
Hi @DmitriySimonov,
Unfortunately we are not to familiar with these settings and how Android adds them. However this seems to be related to the Android notification settings.
Please try to use the
AndroidSettingsclass instead of theLocationSettingsclass and specify detailed information for theforegroundNotificationConfigfield. Something a long the lines of the following code sample:late LocationSettings locationSettings; if (defaultTargetPlatform == TargetPlatform.android) { locationSetting = AndroidSettings( accuracy: LocationAccuracy.bestForNavigation, foregroundNotificationConfig: const ForegroundNotificationConfig( notificationText: "Example app will continue to receive your location even when you aren't using it", // Translate this text into the appropriate language notificationTitle: "Running in Background", // Translate this text into the appropriate language enableWakeLock: true, ), ); } else { locationSettings = LocationSettings( accuracy: LocationAccuracy.bestForNavigation, ); }Please let us know if this helps.
What you sent, there is no channel name setting there Please read the article
https://developer.android.com/develop/ui/views/notifications/channels
Hi @DmitriySimonov,
Thank you for supplying the additional link. This helped me find the location where the channel is set. I noticed indeed that the channel name is hardcoded to "Background Location" in our code base.
I will start a bug fix which will add an additional channelName parameter to the AndroidSettings class which can be used to override the channel name.
Thank you for your work! Looking forward to updates 👍