Android Quickstart
Version: 1.7.0Requirements
- Google Play Services 15.0.1+
- Android Support Library 28
- Glide 4 (Glide 3 is unsupported and cannot co-exist)
- Gradle 4.6+
- Gradle Android plugin 3.2.1+
- A valid Google Map Api key
1. Install SDK
Add Repositories
Our SDK is not hosted on jcenter()
or maven()
and requires Kotlin dependencies not found in the standard repositories.
In order to use the SDK the following repositories must be added to the app build.gradle
:
repositories {
... your other repos ...
maven { url "https://jitpack.io" } // Allows direct resolution of LMG SDK packages from Github
maven { url "http://kotlin.bintray.com/kotlinx" } // for Kotlin
maven { url "https://github.com/loopmediagroup/loopmediagroup-android/raw/master/" }
}
Include the SDK dependency
Add the SDK to the dependencies block in the app build.gradle
:
dependencies {
...
implementation 'com.loopmediagroup.client:sdk:1.7.0' // SDK versions are matched
implementation 'com.loopmediagroup.client:android-ui:1.7.0'
}
Android Configuration
Our SDK uses Android data binding to populate it's views. This must be enabled in the app build.gradle
android configuration:
android {
dataBinding {
enabled = true
}
}
2. Initialization
Create an Integration Write Key
Create a new Integration for your app in the Property you're working with, and use the Integration Write Key to initialize the SDK (below).
See Enabling SDK Integrations for more details.
Initialize the SDK
The SDK initialization must be done inside your application class in order to initialize during the application creation.
In your Application's onCreate()
method:
- Kotlin
- Java
import android.app.Application
import com.loopmediagroup.Configuration
import com.loopmediagroup.LoggerLevel
import com.loopmediagroup.LoopMediaGroup
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
//... your app code ...
val configuration = Configuration.Builder()
.setLoggerLevel(LoggerLevel.Verbose) // Adjust to desired log level. Disable on release builds
.build()
LoopMediaGroup.init("MY_INTEGRATION_KEY", this, configuration)
}
}
import android.app.Application;
import com.loopmediagroup.Configuration;
import com.loopmediagroup.LoggerLevel;
import com.loopmediagroup.LoopMediaGroup;
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//... your app code ...
Configuration configuration = new Configuration.Builder()
.setLoggerLevel(LoggerLevel.Verbose) // Adjust to desired log level. Disable on release builds
.build();
LoopMediaGroup.init("MY_INTEGRATION_KEY", this, configuration);
}
}
3. Additional Configuration
Add a Google Maps API Key
The SDK requires a valid Google Maps Api Key to render maps. Insert the the following into the AndroidManifest.xml
as a child element of the <application>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="MY_MAPS_API_KEY" />
4.Testing your integration
Run app. You should see following message in your log:
CreateSession: Completed successfully