Android SDK Setup

The following instructions will guide you through the process of implementing 10darts SDK into your application. These instructions are based on Android Studio.

Note

Please note that your users’ devices should have Google Play services installed and updated for the proper operation of this SDK

Warning

Before proceeding you should have created a GCM project in your firebase console, please refer to Google Cloud Messaging and follow the steps.

Configure the application

1. Library

Add the following line to your app build.gradle:

  • In android section:
packagingOptions {
    pickFirst 'META-INF/*'
}

defaultConfig
{
    manifestPlaceholders = [
        tendarts_sdk_access_token: "YOUR ACCESS TOKEN",
        tendarts_sdk_client_class:"YOUR CLIENT CLASS",
        gcm_sender_id: "YOUR GCM SENDER ID"
    ]
}
  • In dependencies section:
compile  'com.10darts:sdk:1.25'
  • tendarts_sdk_access_token: your access token to 10darts (API Key)
  • dtendarts_sdk_client_class: the full qualified name of your SDK implementation (see Implementing client class)
  • gcm_sender_id: the sender id you copied in the last step of Google Cloud Messaging

2. Create a client class whose superclass is TendartsClient

Create class

Create class

And implement the methods, default implementation it’s ok for starting but you should add your own functionality as needed.
Implement methods
@Override
public String mainActivityClassName()
{
    return MainActivity.class.getName();
}

Don’t forget to add the full qualified name of this class to tendarts_sdk_client_class on the manifest placeholders.

Add your custom functionality as needed, please refer to TendartsClient class for further documentation

3. Forward functions of your Main Activity

Forward onCreate:

TendartsSDK.onCreate(savedInstanceState, this, new TendartsSDK.ILocationAlerter()
{
    @Override
    public void alertNotEnabled(Activity activity)
    {
        // See Adding Geolocation if you are using this
        // feature otherwise leave empty function.
    }
});

And onResume:

TendartsSDK.onResume(getApplicationContext());

Warning

If you are targeting Android API level higher than 22 you should follow Targeting Android API level >= 23

Note

See Adding Geolocation for increasing location accuracy and receiving location updates.

Note

When a user clicks on the notification the user launches the deep link, check Deep linking