Project Setup - YerdySDK/yerdy-android GitHub Wiki

As Android Library Project

  • Download SDK Source
  • In Eclipse: Import > Android > Existing Android Code into Workspace
  • Browse to and import SDK Source
  • Reference to the SDK as a Android Library Project

or

As jar files

  • add yerdy.jar and gcm.jar to your libs folder
  • add layout-land\yerdy_theme_dialog.xml and layout-port\yerdy_theme_dialog.xml to your project's res folder

and

Update Java files

###Initialize and Configure Yerdy

  • YRDLog.SetLogLevel(YRDLogLevel) (Optional): Yerdy outputs data to LogCat, changing the log level will change the level of messages. YRDLogLevel.YRDLogSilent or YRDLogLevel.YRDLogError are recommended for release.
  • configureMessageDelegate(YerdyMessageDelegate) (Recomended): Used to notify your application of pull message actions
  • configureCurrencies(Context, String[]) (Recomended): Yerdy uses in-game currency changes to track user behaviours. Once set the order cannot be changed without loss or corruption of data, but you can add extras up to 6 total currencies
  • startWithPublisherKey(Context, String) (Required): Initializes the yerdy SDK, to get your publisher key please visit Yerdy
	***NOTE:*** You can find your publisher key in the Yerdy dashboard on the [Account Settings](http://dashboard.yerdy.com/dashboard/account/) page under **Company Details**.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    YRDLog.SetLogLevel(YRDLogLevel.YRDLogVerbose);
    Yerdy.getInstance().configureMessageDelegate(this);
    Yerdy.getInstance().configureCurrencies(this, new String[] { "platinum", "gold", "silver", "copper" });
    Yerdy.getInstance().startWithPublisherKey(this, PUBLISHER_KEY);
}

###Override Activity Life Cycles Yerdy Requires these calls to accurately track user behaviors and sessions times etc.

@Override
protected void onResume() {
    super.onResume();
    Yerdy.getInstance().onResume(this);
}

@Override
protected void onPause() {
    super.onPause();
    Yerdy.getInstance().onPause();
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    Yerdy.getInstance().onWindowFocusChanged(hasFocus, this);
}

Call this when killing the application, not on every activity

@Override
protected void onDestroy() {
    super.onDestroy();
    Yerdy.getInstance().onDestroy();
}

Register and Approve

Build and run your application so it can register itself with the Yerdy servers. Then navigate to the Manage page in the Yerdy dashboard to approve your app.