Digital2Go Android SDK

Digital2Go Android SDK

This document contains the first steps to integrate Digital2Go SDK to your android application, some of the steps may change due different ways to make the process.


  • At least API 19: Android 4.4 (Kitkat)
  • Digital2Go credentials


Once the app is created, open build.gradle (module: app) and add the following to your dependencies {}.

after this, enable the multidex at your defaultConfig{} like this

Now open the file strings.xml at /app/src/main/res/values/strings.xml and add the following:

note: the “app_name” value should stay free of blank spaces

Now open your AndroidManifest.xml and customise like this:

Add permissions:

note: if the API is at least 22 you need to request some permissions at runtime check

Set Meta-Data

also this one for the gms usage

Handle Campaigns

When the sdk finds a campaign, it sends the response through a broadcast receiver action. To catch and handle them you need to create a new broadcastreceiver and set it as the following in your AndroidManifest.xml:

After this you can catch those campaigns in your code like:

The campaign string comes as a JSON object with the following structure:

    "id": 123428614,
    "campaign_content_touch_id": 185893592,
    "campaign_content_near_id": 185893592,
    "campaign_content_far_id": 185893592,
    "campaign_content": {
        "name": "Test Campaign",
        "description": "Test Campaign",
        "notification_message": "This is a notification message",
        "layout": "MISC",
        "sub_layout": "b_video_with_image",
        "check_video": "D2GO",
        "check_image": "D2GO",
        "header_title": "",
        "video_description_text": "This is my video description text right here",
        "product_name": "",
        "product_description": "",
        "product_price": null,
        "interaction_method": "BUTTONS",
        "campaign_content_actions": {},
        "campaign_content_buttons": {
            "id": 33,
            "campaign_content_id": 147750423,
            "is_primary": true,
            "video_id": null,
            "action": "OPEN_URL",
            "data": "",
            "color": "",
            "label": "Open URL",
            "created": "2016-10-20T04:44:41+11:00",
            "modified": "2016-10-20T04:44:41+11:00"
        "media_video": {
            "id": 35673071,
            "filename": "",
            "encoded_file": "",
            "video_thumb": "",
            "video_sthumb": "",
            "duration": 22732,
            "path": "uploads/MediaLibrary/24225/3567471/",
            "mimetype": "video/quicktime",
            "filesize": 14375773,
            "title": null,
            "description": null,
            "width": 1280,
            "height": 720,
            "media_status": "COMPLETE"
        "media_image": {
            "id": 194785093,
            "filename": "24225.991990563004.80f6876f1e51eecf6f884a8801abe819_cropped_Q4fNnB.jpg",
            "path": "uploads/MediaLibrary/24225/7654671/",
            "mimetype": "image/jpeg",
            "filesize": 474305,
            "title": null,
            "description": null,
            "width": 1280,
            "height": 1706,
            "media_status": "EDITED"
            "id": 185893592
        "media_cdn": "",
        "impression_id": 1742945,
        "personas": {
        "age": "18-24",
        "gender": "male"

Push Notifications

Digital2Go SDK uses FirebaseCloud Messaging (FCM) to receive push notifications, in order to receive and handle, please follow FCM Documentation here


The following are the usabe methods exposed by the sdk, here are described how to use them and it’s needs to make it work.



D2GOSDK is available under the MIT license. See the LICENSE file for more info.