Skip to content

Latest commit

 

History

History
120 lines (81 loc) · 4.19 KB

File metadata and controls

120 lines (81 loc) · 4.19 KB

#Android SDK Quick Start

Gimmie Android SDK provides UI and API Wrapper that help you integrate Gimmie loyalty platform to your application. However before start with Android SDK, here is the first few steps you need to register on our portal first for getting your key, secret that use when calling and sending information to our backend.

  1. Signup and create game on Gimmie
  2. Login to portal and going to Games, select your game and click on Developers tab

Integrate Android SDK

Import Gimmie SDK to Eclipse

  • After register your company and create your game, you can start integrate sdk by download latest Gimmie SDK
  • Unzip the sdk file and import all files to Eclipse by select Import

Eclipse import project menu

  • Choose Android > Existing Android code into Workspace

Eclipse android code menu

  • Select Gimmie sdk folder and you will see Gimmie SDK project including all dependencies that Gimmie SDK needs

Gimmie project and all dependencies

  • Click Finish to finish import Gimmie SDK

Link Gimmie SDK to your project

  • Right click on your application folder and select Properties

Project properties

  • Select Android and in Library box click Add

Project library

  • Select Gimmie project and click OK
  • In your AndroidManifest.xml file add this permissions to allow your application connect to internet
<manifest ...>
    ...
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
  • And add Gimmie activity to your application
<manifest ...>
    ...
    
    <application ...>
    ...
      <activity android:name="com.gimmie.components.GimmieView" android:theme="@style/RewardCategoryPage" />
      <activity android:name="com.gimmie.components.RewardDetail" android:theme="@style/GimmieAppeaerance" />
      <activity android:name="com.gimmie.components.BadgeView" android:theme="@style/GimmieAppeaerance" />
      <activity android:name="com.gimmie.components.ClaimsList" android:theme="@style/GimmieAppeaerance" />
      <activity android:name="com.gimmie.components.HistoryList" android:theme="@style/GimmieAppeaerance" />
      <activity android:name="com.gimmie.components.WebView" android:theme="@style/GimmieAppeaerance" />
    
    </application>
</manifest>
  • In addition to UI Gimmie also needs key and secret from above when you create a game. Add the infromation in application here.
<manifest ...>
    ...
    
    <application ...>
      <meta-data android:name="com.gimmie.api.key" android:value="your_game_key_from_portal" />
      <meta-data android:name="com.gimmie.api.secret" android:value="your_game_secret_from_portal" />
    </application>

</manifest>

Initialize

  • Add the following to initialize Gimmie, in onCreate() of your activity
    GimmieComponents components = GimmieComponents.getInstance(this);
    Gimmie gimmie = components.getGimmie();
    gimmie.login("user_id");
  • Add the following to instruct Gimmie to show notifications in the correct context – you can put it in onResume():
    GimmieComponents.registerNotification(this);

Call Gimmie

  • Show Rewards Catalog with the following
    // `this` is your activity instance
    GimmieComponents.showRewardsCatalogue(this);
  • Trigger events with the following
    Gimmie gimmie = GimmieComponents.getInstance(this).getGimmie();
    gimmie.trigger("event_name");

event_name is a unique identifier for events; You can create events and its assocaited actions(give 10 points? give 1 rewards?) in the Gimmie portal.

  • That's all

For more information, you can visit API Docs for more detail information.