jmap_ar_sdk 1.2.2
jmap_ar_sdk: ^1.2.2 copied to clipboard
An AR Flutter SDK with Jibestream
Flutter AR Plugin with Jibestream Indoor Maps Integration #
This Flutter plugin integrates Augmented Reality (AR) capabilities with Jibestream for Indoor Maps. The plugin requires specific native platform configurations in iOS and Android to set up the Jibestream SDK. Follow the instructions below to ensure your Flutter app is properly configured.
Prerequisites #
Flutter SDK (latest stable version) Xcode (for iOS development) Android Studio (for Android development) CocoaPods installed (for iOS dependency management) Installation To install the plugin, add it to your Flutter project's pubspec.yaml file:
Installation #
To install the plugin, add it to your Flutter project's pubspec.yaml file:
dependencies:
jmap_ar_sdk: ^1.2.0
Run the following command to get the package:
flutter pub get
iOS Configuration #
The iOS setup requires some native code changes in your AppDelegate.swift file. Follow these steps:
-
Open your Flutter project in Xcode by navigating to the ios directory and opening the Runner.xcworkspace file.
-
In your AppDelegate.swift's
didFinishLaunchingWithOptionsmethod file, add the following code within the designated section:
let options: [String: String] = [
"GOOGLE_APP_ID": "",
"GCM_SENDER_ID": "",
"API_KEY": "",
"PROJECT_ID": "",
"DATABASE_URL": "",
"STORAGE_BUCKET": ""
]
UserSDK.configure(with: options)
You can add the following helper function to read GoogleService-Info.plist file.
func getGoogleServiceInfo() -> [String: String]? {
// Directly access the GoogleService-Info.plist from the main bundle
guard let filePath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist"),
let plistData = NSDictionary(contentsOfFile: filePath) as? [String: Any] else {
print("Failed to load GoogleService-Info.plist")
return nil
}
// Retrieve the required keys from the plist data
let keysToExtract = ["GOOGLE_APP_ID", "GCM_SENDER_ID", "API_KEY", "PROJECT_ID", "DATABASE_URL", "STORAGE_BUCKET"]
var googleServiceInfoDict: [String: String] = [:]
for key in keysToExtract {
if let value = plistData[key] as? String {
googleServiceInfoDict[key] = value
}
}
return googleServiceInfoDict
}
- Make sure to add the GoogleService-Info.plist file to your Xcode project. This file is required for the SDK configuration.
- If your app uses Firebase, make sure to add the following to your Podfile:$FirebaseSDKVersion = '10.29.0' # Google Cloud Anchor only supports
$FirebaseSDKVersion = '10.29.0' # Google Cloud Anchor doesn't supports Firebase version greater than 10.29.0
This line should be added before the target 'Runner' do line.
Android Configuration #
For Android, you will need to modify the MainActivity.kt file. Follow these steps:
-
Open your Flutter project in Android Studio.
-
Add these two lines in
android/build.gradle
maven { url "https://cxapp.jfrog.io/artifactory/android-cxapp/" }
maven { url "https://jitpack.io" }
- In the
MainActivity.ktfile, add the following code within the designated section:
import com.cxapp.sdk.ar.user.ARUserSDK
override fun onCreate(savedInstanceState: Bundle?) {
val dataConfig = HashMap<String, String>()
dataConfig["projectId"] = ""
dataConfig["applicationId"] = ""
dataConfig["apiKey"] = ""
ARUserSDK.configure(dataConfig)
super.onCreate(savedInstanceState)
}
- Ensure that you have the necessary permissions and dependencies in your AndroidManifest.xml file as required by the AR and Jibestream SDKs.
Flutter Usage #
void _startLocalization() {
final jMapARSDK = JMapARSDK();
final config = JMapConfig(
'https://api.jibestream.com',
'yourClientID',
'yourClientSecret',
1234, // Customer ID
5678, // Venue ID
9101, // Building ID
1121 // Floor ID
);
jMapARSDK.startLocalization(mapConfig);
}