startLocation method

  1. @override
Future<void> startLocation()
override

Starts the location services for the Grouplink SDK. This method is used to enable location tracking. It checks the platform and invokes the appropriate method channel. This method is typically called after the SDK has been initialized.

Implementation

@override
Future<void> startLocation() async {
  if (Platform.isIOS) {
    try {
      await iOSSDKChannel.invokeMethod<String>('startiOSLocation');
    } on PlatformException catch (e) {
      log("Error startiOSLocation: ${e.message}");
      rethrow;
    }
  }
  if (Platform.isAndroid) {
    try {
      await methodChannel.invokeMethod('requestPermissionLocation');
    } on PlatformException catch (e) {
      log("Error requestPermissionLocation: ${e.message}");
      rethrow;
    }
  }
}