GoSave developers site
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
android-sdk-reference.md
gosave-android-sdk.jar

README.md

Android SDK Integration Guide

This guide provides step-by-step instructions for adding GoSave rewards to your Android application.

Step 1: Register Your Android App

You will need both an App ID and an App Secret Key (not implemented yet) to integrate your app (one set per app).

IMPORTANT: For beta developers, we create authentication keys and send them in a separate document via email. If additional keys are required, they will be issued upon request.

Step 2: Download the GoSave SDK

The latest GoSave SDK can be downloaded from here.

Currently, GoSave supports Android SDK 17 and higher.

Step 3: Add the GoSave Library

After you have downloaded the GoSave SDK, you will need to import it into your project.

Step 4: Modify your AndroidManifest.xml

In order to make the GoSave SDK accessible to your application, you will need to add the following lines to your AndroidManifest.xml:

Initialise GoSave

<meta-data
    android:name="GS_APP_ID"
    android:value="\ %GoSave Application ID%"/>
<meta-data
    android:name="GS_APP_SECRET"
    android:value="\ %GoSave Application Secret%"/>

Replace %GoSave Application ID% and %GoSave Application Secret% with your App ID and App Secret Key.

Example: android:value="\ 75122001847832" Yes, please include the backslash and space "\ " before the App ID and App Secret Key.

Add GoSave Permissions

In your AndroidManifest.xml, you will need to add the following permissions (if your manifest file does not already include them) to use the GoSave SDK.

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SET_DEBUG_APP"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Declare GoSave Components

In the application block of AndroidManifest.xml, declare the following application components:

<activity
    android:name="com.gosave.sdk.android.ui.MiniAppActivity"
    android:configChanges="orientation|screenSize"
    android:screenOrientation="sensor">
</activity>
<activity
    android:name="com.vungle.sdk.VungleAdvert"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<activity
    android:name="com.jirbo.adcolony.AdColonyOverlay"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
<activity
    android:name="com.jirbo.adcolony.AdColonyFullscreen"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"/>
<activity
    android:name="com.jirbo.adcolony.AdColonyBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"/>
<activity
    android:configChanges="screenSize|orientation"
    android:name="com.sponsorpay.publisher.mbe.SPBrandEngageActivity"
    android:hardwareAccelerated="true"/>
<activity
    android:name="com.tapjoy.TJCOffersWebView"
    android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity
    android:name="com.tapjoy.TapjoyFullScreenAdWebView"
    android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity
    android:name="com.tapjoy.TapjoyVideoView"
    android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity
    android:name="com.tapjoy.TJAdUnitView"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
    android:hardwareAccelerated="true"/>
<activity
    android:name="com.tapjoy.mraid.view.ActionHandler"
    android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity
    android:name="com.tapjoy.mraid.view.Browser"
    android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity
    android:name="com.vdopia.ads.lw.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<activity
    android:name="com.vdopia.ads.lw.mraid.MraidBrowserActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<activity
    android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
</activity>

<service android:name="com.vungle.sdk.VungleIntentService"/>

Step 5: Add a GoSave Button

In order to enable your users to view the GoSave Mini-App from within your application, you must provide them with the ability to tap a button to load the GoSave Mini-App. Most commonly, this button is included in the main menu or on your user’s account page.

public class YourActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize GoSave
    GoSaveManager.initialize(this);

    final Button miniAppButton = (Button) findViewById(R.id.goSaveMiniApp);
    miniAppButton.setOnClickListener(new View.OnClickListener() {
      public void onClick(View v) {
        // Show GoSave Mini-App on Button click
        GoSaveManager.openApp();
      }
    });
  }
}

Step 6: Display GoSave InApp Notifications for Events

Visual notifications may accompany certain events in your app. These notifications serve to reward your users for triggering events you have designated for your app. Events are designed for you as a developer to reward end users at key moments that create the most value and are unique to your app content. You can choose specific events to trigger notifications. For example, when a user logs in to your app, completes a profile, reaches a score or level, etc.

public class YourActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize GoSave
    GoSaveManager.initialize(this);
  }

  private void onSampleEvent(){
    // Process event and display notification if needed
    GoSaveManager.processEvent("EVENT_ID");

    // Process event with game score
    GoSaveManager.processEvent("EVENT_ID", 90);

    // Process event discretely - without displaying a notification
    // if you don't want to disturb users
    GoSaveManager.processEvent("EVENT_ID", true);

    // Process event discretely with game score
    // if you don't want to disturb users
    GoSaveManager.processEvent("EVENT_ID", 100, true);

    // Display notifications for all previous discretely processed events
    // Normally, you would use this after the game process has ended
    GoSaveManager.commitSilentEvents();

    // Display notifications for all unlocked achievements
    // Normally, you would use this after the game process has ended
    GoSaveManager.commitUnlockAchievements();
  }
}