cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
548 stars 672 forks source link

[mobility_features] #824

Open rajeshbdabhi opened 1 year ago

rajeshbdabhi commented 1 year ago

Describe the bug

onMobilityContext in this method not getting any callback even location update is working

Expected behavior

/// Handle incoming contexts void onMobilityContext(MobilityContext context) { /// Do something with the context print('Context received: ${context.toJson()}'); } should get callback in this function and not printing any logs even i enable debug mode MobilityFeatures().debug = true; using this way

Flutter doctor

[✓] Flutter (Channel stable, 3.10.4, on macOS 13.6 22G120 darwin-x64, locale en-GB) • Flutter version 3.10.4 on channel stable at /Users/rajeshdabhi/Desktop/Work/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 682aa387cf (5 months ago), 2023-06-05 18:04:56 -0500 • Engine revision 2a3401c9bb • Dart version 3.0.3 • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/rajeshdabhi/Library/Android/sdk • Platform android-33, build-tools 33.0.2 • ANDROID_HOME = /Users/rajeshdabhi/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14B47b • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2022.3) • 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 17.0.6+0-17.0.6b829.9-10027231)

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

[✓] Network resources • All expected network resources are available.

• No issues found! Process finished with exit code 0

timsar2 commented 5 months ago

I made a pull request for it: pull request 971

First thing first, Remove all background locator from android manifest xml and replace back ground locator2 with min flutter sdk 3:

<receiver android:name="yukams.app.background_locator_2.BootBroadcastReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>

<service android:name="yukams.app.background_locator_2.IsolateHolderService"
    android:permission="android.permission.FOREGROUND_SERVICE"
    android:exported="true"
    android:foregroundServiceType = "location"/>

Also for android > 14 need to add permission forground service in android manifest xml: <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />