rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
288 stars 328 forks source link

Android settings not working? #235

Closed dslingr closed 3 years ago

dslingr commented 3 years ago

Version: ^1.6.0+1-beta

I'm not sure if I'm doing something wrong, but when I run this code:

BackgroundLocator.registerLocationUpdate(LocationCallbackHandler.callback,
        iosSettings: IOSSettings(
            accuracy: LocationAccuracy.NAVIGATION, distanceFilter: 0),
        autoStop: false,
        androidSettings: AndroidSettings(
            accuracy: LocationAccuracy.NAVIGATION,
            interval: 5,
            distanceFilter: 0,
            client: LocationClient.google,
            androidNotificationSettings: AndroidNotificationSettings(
                notificationChannelName: 'Location tracking',
                notificationTitle: 'Start Location Tracking',
                notificationMsg: 'Track location in background',
                notificationBigMsg:
                    'Background location is on to keep the app up-tp-date with your location. This is required for main features to work properly when the app is not running.',
                notificationIconColor: Colors.grey,
                notificationTapCallback:
                    LocationCallbackHandler.notificationCallback)));

I get a white icon and the notification says "[appname] is running"..."Tap for more information or to stop the app." None of the custom notification messages show up.

Everything else seems to be working fine.

[✓] Flutter (Channel stable, 2.0.5, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-US)
    • Flutter version 2.0.5 at /Users/dasmobile/Development/flutter
    • Framework revision adc687823a (10 days ago), 2021-04-16 09:40:20 -0700
    • Engine revision b09f014e96
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/dasmobile/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.55.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • Pixel 2 XL (mobile) • 711KPWQ0547977 • android-arm64  • Android 11 (API 30)
    • Chrome (web)        • chrome         • web-javascript • Google Chrome 90.0.4430.85

• No issues found!
Wian-TMC commented 3 years ago

Same here

BecoStopclub commented 3 years ago

It's 1.6.0+1-beta bug.

Workaround:

Call:


BackgroundLocator.updateNotificationText();

After


BackgroundLocator.registerLocationUpdate();
dslingr commented 3 years ago

It's 1.6.0+1-beta bug.

Workaround:

Call:


BackgroundLocator.updateNotificationText();

After


BackgroundLocator.registerLocationUpdate();

That fixed it. Thanks!