Getting Started
This documentation explains how to get started integrating your Android app with Spaces by using the Spaces SDK for Android. The current version of the Spaces SDK for Android is version 1.0.0 and requires the Android API 15. For more information about versions and features, see Spaces SDK for Android.
When you use the Spaces SDK, some events in your app are automatically logged and collected unless you disable automatic event logging. For details about what information is collected and how to disable automatic event logging, see Automatic App Event Logging.
You can set up your app to use the Spaces SDK for Android in the following ways:
- By using the Quick Start.
- By setting up your project with the Spaces SDK for Android.
Quick Start
To get a Spaces App ID, configure your app's settings, and import the Spaces SDK for Android, click here and follow the instructions.
Before You Start
You will need:
- Your Spaces App ID
- Your Spaces App Client Token
Android Studio Setup
Create Your Project
To use the Spaces SDK in an Android Studio project, add the SDK as a build dependency and import the SDK.
- Go to Android Studio | New Project | Minimum SDK.
- Select API 15: Android 4.0.3 (IceCreamSandwich) or higher and create your new project.
- Open the file
Gradle Scripts | build.gradle (Project: <your_project>)and add the following:
mavenCentral()
- Save and close the
build.gradle (Project: <your_project>)file. - Open the file
Gradle Scripts | build.gradle (Module: app)and add the following to thedependenciessection:
implementation 'com.spaces.android:spaces-android-sdk:latest.release'
- Save and close the
build.gradle (Module: app)file. - Build your project. Now you can import com.spaces.androidsdk into your app.
Update Your Manifest
Add your App ID and Client Token to your project's string file and update the manifest file. Do the following:
- Open the
/app/res/values/strings.xmlfile in your app project. - Add string elements with the names spaces_app_id and spaces_client_token, and set the values to your App ID and Client Token. For example, if your app ID is 1234 and your client token is 56789 your code looks like the following:
<string name="spaces_app_id">1234</string>
<string name="spaces_client_token">56789</string>
- Open the
/app/manifests/AndroidManifest.xmlfile in your app project. - Add meta-data elements to the application element for your app ID and client token:
<application android:label="@string/app_name" ...>
...
<meta-data android:name="com.spaces.sdk.ApplicationID" android:value="@string/spaces_app_id"/>
<meta-data android:name="com.spaces.sdk.ClientToken" android:value="@string/spaces_client_token"/>
...
</application>
- Add a uses-permission element to the manifest after the application element:
<uses-permission android:name="android.permission.INTERNET"/>
- Build your project.