flutter_ai_indoor_navigation 0.4.0 copy "flutter_ai_indoor_navigation: ^0.4.0" to clipboard
flutter_ai_indoor_navigation: ^0.4.0 copied to clipboard

A Flutter wrapper for the Combain AI Navigation SDK.

Combain Indoor AI Navigation Plugin #

This plugin is a wrapper for the Combain Indoor AI Navigation SDK. It provides a simple way to integrate the SDK into your Flutter app.

Getting Started #

This is all the code needed to start receiving indoor location updates from the Combain Indoor AI Navigation SDK.

Future<void> initIndoorNavigationSDK() async {
  var config = FlutterIndoorNavigationSDKConfig(
      apiKey: Secrets.apiKey,
      syncingInterval: SyncingInterval(interval: 0),
      routingConfig: FlutterRoutingConfig(
          routableNodesOptions:
              FlutterRoutableNodesOptions.allExceptDefaultName));

  val aiIndoorNavigationSDK = await FlutterIndoorNavigationSDK.create(config);
  await aiIndoorNavigationSDK.start();
}
copied to clipboard

Demo #

For a demo project see https://gitlab.combain.com/Hugo-Persson/flutter-ai-navigation-demo

Setup #

Android #

For proper permission handling, your MainActivity must extend FlutterFragmentActivity instead of the default FlutterActivity. This is required because the SDK needs access to ComponentActivity features for permission management.

In your android/app/src/main/kotlin/.../MainActivity.kt:

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterFragmentActivity()
copied to clipboard

Note: If your MainActivity currently extends FlutterActivity, simply change it to FlutterFragmentActivity and update the import statement.

Required Permissions in AndroidManifest.xml

Add the following permissions to your android/app/src/main/AndroidManifest.xml file:

<!-- Required permissions for Bluetooth and location services -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
copied to clipboard

Note: These permissions are required for the SDK to function properly, especially for Bluetooth beacon detection and location services. The neverForLocation flag on BLUETOOTH_SCAN indicates that Bluetooth scanning is not used for location purposes.

Permissions #

iOS #

The following values needs to be specified in the info.plist

  • NSMotionUsageDescription
  • NSLocationWhenInUseUsageDescription

And this needs ot be added to Podfile:

target.build_configurations.each do |config|
      # You can remove unused permissions here
      # for more information: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
      # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',


        ## The 'PERMISSION_LOCATION' macro enables the `locationWhenInUse` and `locationAlways` permission. If
        ## the application only requires `locationWhenInUse`, only specify the `PERMISSION_LOCATION_WHENINUSE`
        ## macro.
        ##
        ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
        'PERMISSION_LOCATION_WHENINUSE=1',
        'PERMISSION_SENSORS=1',
      ]

    end
copied to clipboard

see https://github.com/Baseflow/flutter-permission-handler/tree/main/permission_handler#setup