cordova-plugin-galaxy

1.2.4 • Public • Published

Cordova Galaxy plugin for Android and iOS.

Table of content

Installation

$ cordova plugin add cordova-plugin-galaxy

Setup

Add the following lines to your code to be able to initialize tracking with your own Galaxy Publishable key:

document.addEventListener('deviceready', function() {

  // InitSDK
  window.galaxy.InitSDK({
    publishableKey: 'Your Galaxy Publishable Key',
  }, (result) => {
    console.log(result);
  }, (error) => {
    console.error(error);
  });


  /* Client API */

  // ReportScore
  document.getElementById('button').addEventListener(
    'click',
    (e) => window.galaxy.ClientAPI.ReportScore({
      leaderboard_id: 'Your Leaderboard Id',
      score: 1,
    }, (result, error) => {
      console.log(result);
    }),
  );


  /* Galaxy UI */

  // ShowLeaderboard
  document.getElementById('button').addEventListener(
    'click',
    (e) => window.galaxy.ShowLeaderboard({
      leaderboard_id: 'Your Leaderboard Id',
    }, (result) => {
      console.log(result);
    }, (error) => {
      console.error(error);
    }),
  );

  // ShowAvatarEditor
  document.getElementById('button').addEventListener(
    'click',
    (e) => window.galaxy.ShowAvatarEditor((result) => {
      console.log(result);
    }, (error) => {
      console.error(error);
    }),
  );

  // ShowClan
  document.getElementById('button').addEventListener(
    'click',
    (e) => window.galaxy.ShowClan({
      leaderboard_id: 'Your Leaderboard Id',
      clan_id: 'clan id'
    }, (result) => {
      console.log(result);
    }, (error) => {
      console.error(error);
    }),
  );

 }, false);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.4
    4
    • latest

Version History

Package Sidebar

Install

npm i cordova-plugin-galaxy

Weekly Downloads

1

Version

1.2.4

License

Apache-2.0

Unpacked Size

36.7 kB

Total Files

5

Last publish

Collaborators

  • jehun
  • adambn