Android API Documentation

Setting up the Android API

Download Browse on Github

Copy the Playtomic folder and everything in it to your game's folder.

Initialize the API and log the view

Before you do anything else you must initialize the API using your credentials from the dashboard. Once you have done that, you can log the view when the player opens your game or resumes it.

To initialize the Playtomic API you need to get a reference to an object of the class Playtomic an save it in a member variable of your Application class. For an explanation of the Application object an its life cycle read Android Application class.

public class TestApp extends Application {

    // we need a reference to the Playtomic API
        private Playtomic playtomic = null;

    @Override
    public void onCreate() {
        super.onCreate();
        // get a reference to the singleton Playtomic class
        // 
        // Get your credentials from the Playtomic dashboard (add or select game then go to API page)
                playtomic = Playtomic.getInstance(
                                            /*replace with gameId*/, 
                                            /*replace with gameGuid*/, 
                                            /*replace with apikey*/, 
                                            this);
        Playtomic.Log().view();
    }
}

SSL (https)

Premium users can use SSL for all API communication by calling this method after initializing the API but before logging the view:

Playtomic.setSSL();