Advanced SDK Usage

This article includes code samples. If you would like to see them for a specific language, select a language now.

The Moonsense SDK is offered in it's standard version, referred to as the Cloud version, and a Core version. The Cloud version is the most commonly used version and provides all the benefits of the Moonsense Cloud for data retention, viewing, and webhooks. However, for some advanced use cases where data cannot be moved to an outside organization the Core version exists. The Core version removes all the networking instrumentation from the standard SDK to allow the implementer to build their own integrations.

ℹ️  The Core SDK requires separate licensing to use. If you are interested in the Core SDK, please reach out to support@moonsense.io.

Differences

The Cloud and Core SDKs have some differences in implementation due to the difference in the target destination for data being generated by the SDK.

Configuration

The Cloud SDK requires a Moonsense public token to operate. Due to the Core SDK not communicating with the Moonsense Cloud, the public token is not required when configuring the Core SDK.

The Core SDK also has different dependencies for implementation. To add the Core SDK, you will include the following dependencies: android-core-sdk, MoonsenseCoreSDK.xcframework, and moonsense-web-core-sdk.

Additionally, the wire framework is required for the Android Core SDK so the following will need to be added to your sdk:

implementation("com.squareup.wire:wire-runtime:<latest_version>")

Callbacks

The Core SDK adds an additional callback method called onBundleCreated(...) that can be configured in MoonsenseCallback. This additional callback allows sensor data bundles to be accumulated and handled by the implementing SDK.

moonsenseCallback = object : MoonsenseCoreCallback { // ... standard Callback implementation override fun onBundleCreated(session: Session, bundle: Bundle) { // Handle bundle data here } }
extension ViewController: MoonsenseCoreDelegate { // ... standard Delegate implementation func sessionDidCreateBundle(_ session: Session, bundle: Bundle) { // Handle bundle data here } }
const myCallback = { // ... standard Callback implementation onBundleCreated: (session, bundle) => { // Handle bundle data here } }

Samples

A sample implementation demonstrating integration of the Moonsense Core SDK can be found in the sample projects repositories: