This article covers the integration of GeoSpark Android SDK.
This article covers the integration of GeoSpark Android SDK. GeoSpark Android SDK enables you to track your user location in both online and offline states. The SDK enables you to track location in foreground, background and terminated app state. Our SDK tracks location with minimal battery drain.
Here are the steps involved in integrating GeoSpark's Android SDK with your app:
Open Android Studio, start a new Android Studio project and create project.
Select minimum SDK Android 4.1.
Select Empty Activity and finish.
Install the SDK to your project via Gradle in Android Studio and add the dependencies below in your app build.gradle file.
Set FCM DeviceToken to create a user. If you haven't set FCM DeviceToken already, then add Firebase to your Android project.
Sign up here to create an account with GeoSpark. Post signup, you can create your first project from the dashboard screen.
Once you have created your project, you can add App Name, Package Name and create Android applications.
You can get the publishable key from your project settings page which has to be used while integrating the SDK with your application.
In onCreate method of your Application class, Initialize the SDK with your PUBLISH _KEY.
GeoSpark SDK needs a User ID object to identify the device. The SDK has a convenience method createUser() to create a user which returns User ID.
To enable location, call the requestPermissions and requestLocationServices method. For Android 6.0 and above, calling this method will trigger a location permission popup that the user has to allow and startTracking the user location.
Start viewing your user's location data on the dashboard.
Your Application is successfully integrated with GeoSpark Android SDK.