flutter_sdk_app 0.1.0 copy "flutter_sdk_app: ^0.1.0" to clipboard
flutter_sdk_app: ^0.1.0 copied to clipboard

A Flutter package for Geosentry SDK integration via platform channels.

flutter_sdk_app #

A Flutter package for Geosentry SDK integration via platform channels.

Usage #

Import the package:

import 'package:flutter_sdk_app/flutter_sdk_app.dart';

Initialize the SDK:

final result = await GeosentrySDK.initializeSDK(
  apiKey: 'YOUR_API_KEY',
  cipherKey: 'YOUR_CIPHER_KEY',
  userID: 'YOUR_USER_ID',
);
print(result);

See the example/ directory for a complete usage example.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Integrating a Native AAR File in a Flutter Application #

This guide explains how to integrate a native Android AAR library (e.g., geosentry_sdk.aar) into your Flutter project and resolve common dependency issues.


1. Place the AAR File #

  • Copy your .aar file (e.g., geosentry_sdk.aar) into the android/app/libs/ directory.

2. Update Gradle Configuration #

a. Repositories #

  • Open android/app/build.gradle.
  • Ensure the following is present in the repositories block:
    flatDir {
        dirs 'libs'
    }
    

b. Dependencies #

  • In the dependencies block, add:
    implementation(name: 'geosentry_sdk', ext: 'aar')
    
  • Add required dependencies for the AAR (Room, WorkManager, etc.):
    implementation "androidx.room:room-runtime:2.5.2"
    annotationProcessor "androidx.room:room-compiler:2.5.2"
    implementation "androidx.work:work-runtime:2.8.1"
    implementation "androidx.work:work-runtime-ktx:2.8.1"
    

3. Sync and Clean Project #

  • Run the following commands in your project root:
    flutter clean
    flutter pub get
    
  • Open the Android module in Android Studio and let Gradle sync.

4. Access Native Functionality & Pass Parameters #

  • Use Flutter's platform channels to communicate with native Android code that uses the AAR.
  • Example (Dart):
    static const platform = MethodChannel('com.example.channel');
    await platform.invokeMethod('initSdk', {
      'apikey': 'YOUR_API_KEY',
      'cipherkey': 'YOUR_CIPHER_KEY',
      'userid': 'YOUR_USER_ID',
    });
    
  • In your Android code (MainActivity.java or MainActivity.kt), handle the method call and pass the parameters to your SDK:
    class MainActivity : FlutterActivity() {
        private val CHANNEL = "com.example.channel"
        override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
            super.configureFlutterEngine(flutterEngine)
            MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
                if (call.method == "initSdk") {
                    val apikey = call.argument<String>("apikey")
                    val cipherkey = call.argument<String>("cipherkey")
                    val userid = call.argument<String>("userid")
                    // Pass these to your SDK initialization
                    // Example: GeoSentrySdk.init(apikey, cipherkey, userid)
                    result.success(null)
                } else {
                    result.notImplemented()
                }
            }
        }
    }
    
  • Implement the corresponding SDK initialization using the received parameters.

5. Build and Run #

  • Run your app on an Android device or emulator:
    flutter run
    
  • Ensure there are no runtime errors related to missing classes from the AAR.

6. Troubleshooting #

  • If you see NoClassDefFoundError or ClassNotFoundException, check that all required dependencies for the AAR are added in build.gradle.
  • Make sure the AAR file name matches the one referenced in the implementation line.
  • Clean and rebuild the project if changes are not reflected.

7. Additional Notes #

  • If your AAR requires permissions or setup, update android/app/src/main/AndroidManifest.xml accordingly.
  • For Kotlin-specific dependencies, uncomment the following in build.gradle if needed:
    // implementation "androidx.room:room-ktx:2.5.2"
    // kapt "androidx.room:room-compiler:2.5.2"
    

References:

For further help, contact your SDK provider or refer to the official documentation for the AAR library.

Integrating a Native Framework in a Flutter iOS Application #

This guide explains how to integrate a native iOS framework (e.g., Geosentry_SDK.framework) into your Flutter project and pass parameters from Dart to native iOS code.


1. Place the Framework #

  • Copy your .framework file (e.g., Geosentry_SDK.framework) into ios/New Group/ or another suitable directory inside your iOS project.

2. Add Framework to Xcode Project #

  • Open ios/Runner.xcworkspace in Xcode.
  • Right-click on the Runner project > Add Files to "Runner"... > select your framework.
  • Ensure the framework is listed under Frameworks, Libraries, and Embedded Content in your target settings.
  • Set the framework to "Embed & Sign" if required.

3. Update Info.plist and Build Settings #

  • If your framework requires permissions, add them to ios/Runner/Info.plist.
  • If needed, update Framework Search Paths in your target's build settings to include the framework directory (e.g., $(PROJECT_DIR)/New Group).

4. Access Native Functionality & Pass Parameters #

  • Use Flutter's platform channels to communicate with native iOS code that uses the framework.
  • Example (Dart):
    static const platform = MethodChannel('com.example.channel');
    await platform.invokeMethod('initSdk', {
      'apikey': 'YOUR_API_KEY',
      'cipherkey': 'YOUR_CIPHER_KEY',
      'userid': 'YOUR_USER_ID',
    });
    
  • In your iOS code (AppDelegate.swift), handle the method call and pass the parameters to your SDK:
    import UIKit
    import Flutter
    import Geosentry_SDK // Import your framework
    
    @UIApplicationMain
    @objc class AppDelegate: FlutterAppDelegate {
      override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
      ) -> Bool {
        let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
        let channel = FlutterMethodChannel(name: "com.example.channel", binaryMessenger: controller.binaryMessenger)
        channel.setMethodCallHandler { (call: FlutterMethodCall, result: @escaping FlutterResult) in
          if call.method == "initSdk" {
            if let args = call.arguments as? [String: Any] {
              let apikey = args["apikey"] as? String
              let cipherkey = args["cipherkey"] as? String
              let userid = args["userid"] as? String
              // Pass these to your SDK initialization
              // Example: GeoSentrySdk.init(apikey: apikey, cipherkey: cipherkey, userid: userid)
              result(nil)
            } else {
              result(FlutterError(code: "INVALID_ARGUMENTS", message: "Arguments missing", details: nil))
            }
          } else {
            result(FlutterMethodNotImplemented)
          }
        }
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
      }
    }
    
  • Implement the corresponding SDK initialization using the received parameters.

5. Build and Run #

  • Run your app on an iOS device or simulator:
    flutter run
    
  • Ensure there are no runtime errors related to missing classes from the framework.

6. Troubleshooting #

  • If you see errors about missing symbols or frameworks, check that the framework is properly added and embedded in Xcode.
  • Ensure the framework is compatible with your target architecture and iOS version.
  • Clean and rebuild the project if changes are not reflected.

7. Additional Notes #

  • If your framework requires permissions or setup, update ios/Runner/Info.plist accordingly.
  • For Objective-C, use AppDelegate.m and adjust the method channel code accordingly.

References:

For further help, contact your SDK provider or refer to the official documentation for the framework.

0
likes
160
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for Geosentry SDK integration via platform channels.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on flutter_sdk_app

Packages that implement flutter_sdk_app