Initialize the SDK

You need to initialize the adjoe SDK before you can use any of its features. To do this, call window.AdjoePlugin.initinitialize(String, Object, function, function) when your app is starting. The initialization will run asynchronously in the background and notify you when it is finished by invoking one of the callback methods. After one successful initialization all following calls to window.AdjoePlugin.initialize will immediately invoke the success callback until your app is removed from the heap. The SDK initialization should be started as soon as possible after the app starts to make sure that all adjoe features are available when you want to use them.

Best practices for the SDK initialization:

  • Initialize early: You should initialize the SDK as soon as possible after your app starts to make sure that all adjoe features are available when you want to use them.

  • Initialize regularly: For the best user experience, we highly recommend to call this method every time your app comes to the foreground. This should not be noticeable in your app's performance.

  • Initialization triggers: Good places to call this method are the app start and resume.

window.AdjoePlugin.initialize(
  'sdkHash',
  options,
  function() {
      // the adjoe plugin was initialized successfully
  },
  function(err) {
      // an error occurred while initializing the adjoe plugin.
  },
);

The parameters to this call are as follows:

  • String sdkHash: You adjoe API key.

  • Object options: An object for passing additional values to the initialization of adjoe. Currently the following options are supported:

    • String user_id: A custom identifier that you wish to assign to this user. If you don't have an identifier for your user already, the adjoe SDK will generate one. You can then access it by calling window.AdjoePlugin.getUserId(function, function).

If you want to use S2S payout, you have to set the user id in order to match the payout to your user.

Sub-IDs

You can pass twooptional Sub-UDs when you initialize the SDK: window.Adjoeplugin.initializeWithSubIDs('sdkHash', options, '<subId1>', '<subId2>', success, error).

Last updated