Download & Initialise the SDK
How to get the SDK working in your environment
Last updated
Was this helpful?
How to get the SDK working in your environment
Last updated
Was this helpful?
Whether embedding or building, you'll first need to configure your development environment to get access to the SDK. You'll need the credentials included in your "Welcome pack" to get going.
If you're an existing customer and can't find your Welcome Pack, please raise a ticket via support@monterosa.co or speak to your Account Manager.
If you use Swift Package Manager, add the following GIT repository URL as a new package dependency in Xcode:
https://<package-username>:<package-token>@gitlab.com/monterosa-sdk/ios.git
Finally, select MonterosaSDKCore
and MonterosaSDKLauncherKit
from the list of available Package Products.
If you use CocoaPods, add the following to your app target in your Podfile
target 'MyApp' do
username = "<YOUR USERNAME>"
token = "<YOUR TOKEN>"
version = "0.16.13"
url = "https://#{username}:#{token}@gitlab.com/monterosa-sdk/ios.git"
pod 'MonterosaSDKCommon', :git => url, :tag => version
pod 'MonterosaSDKConnectKit', :git => url, :tag => version
pod 'MonterosaSDKCore', :git => url, :tag => version
pod 'MonterosaSDKLauncherKit', :git => url, :tag => version
pod 'MonterosaSDKIdentifyKit', :git => url, :tag => version
end
Add our private registry URL and credentials to the project-level settings.gradle
with your Gradle DSL of choice:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven {
url = uri("https://gitlab.com/api/v4/projects/38419902/packages/maven")
credentials(HttpHeaderCredentials::class.java) {
name = "Deploy-Token"
// The format of the token should be similar to: 'SC3hJTmsGtEJFpwk-XEU'
value = "<package token>"
}
authentication {
val header by registering(HttpHeaderAuthentication::class)
}
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven {
url "https://gitlab.com/api/v4/projects/38419902/packages/maven"
credentials(HttpHeaderCredentials) {
name = 'Private-Token'
// The format of the token should be similar to: 'SC3hJTmsGtEJFpwk-XEU'
value = '<package token>'
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
Update your module's build.gradle
file so as to add the kotlin-parcelize and the following packages as dependencies:
plugins {
...
id("kotlin-parcelize")
}
...
dependencies {
...
// Ensure you are using the latest version
implementation("co.monterosa.sdk:core:0.16.13")
implementation("co.monterosa.sdk:launcherkit:0.16.13")
implementation("co.monterosa.sdk:interactkit:0.16.13")
implementation("co.monterosa.sdk:identifykit:0.16.13")
...
}
plugins {
...
id "kotlin-parcelize"
}
...
dependencies {
...
// Ensure you are using the latest version
implementation "co.monterosa.sdk:core:0.16.13"
implementation "co.monterosa.sdk:launcherkit:0.16.13"
implementation "co.monterosa.sdk:interactkit:0.16.13"
implementation "co.monterosa.sdk:identifykit:0.16.13"
...
}
And finally, add the following rule to your proguard-rules.pro
file :
# Monterosa SDK rules
-keep class co.monterosa.sdk.** { *; }
-dontwarn java.lang.management.**
-dontwarn androidx.window.extensions.**
-dontwarn androidx.window.extensions.embedding.**
-dontwarn androidx.window.sidecar.**
You may need to invalidate Anroid Studio's cache if this error is raised:
Gradle sync (Failed to resolve: co.monterosa.sdk:{kit}:X.Y.Z and Failed to resolve: co.monterosa.sdk:{kit}:X.Y.Z).
To invalidate the cache you'll need to delete the cache folder, which is located at:
On Windows: %USERPROFILE%.gradle\caches
On Mac/UNIX: ~/.gradle/caches/
You can browse to these directory and manually delete it or run on your terminal:
rm -r $HOME/.gradle/caches/
After that use the Invalidate Caches / Restart
option of Android Studio.
All Interaction SDK packages are scoped as @monterosa-sdk
. Run the following NPM commands to tell NPM where to look for packages from that scope:
npm config set @monterosa-sdk:registry https://gitlab.com/api/v4/projects/38419920/packages/npm/
npm config set //gitlab.com/api/v4/projects/38419920/packages/npm/:_authToken "<package token>"
Finally, execute the following commands to install the required packages:
npm install @monterosa-sdk/core
npm install @monterosa-sdk/launcher-kit
npm install @monterosa-sdk/interact-kit
Important: The JavaScript SDK can only be run in a browser environment and is not intended to be used with Node.js.
You will also need to include all Stable polyfills for environments that don't support the features required by Monterosa / Interaction SDK.
Once you have access to the SDK, you'll have to configure it during the startup of your application, so it is able to access your project. For that, you'll need a static host
and a project id
, which .
import UIKit
import MonterosaSDKCore
@UIApplicationMain
class AppDelegate: UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
Core.configure(host: "<static host>", projectId: "<project id>")
...
}
}