title: OneSignal Get Player Id
body: <p>I'm doing an app for a homework in my school and I'm using Onesignal REST API, but I want to save the player id in my database to use it in another application like a server sender.<br> My application is in <em>intel xdk</em> and I'm using Cordova to build on Android.<br> The problem is that I can't find any example getting the player id.<br> Can anybody help me with this problem ? </p>
  
  <p>I'm using JavaScript
  Thanks. </p>
  
  <p>this is what I have in my .js :</p>
  
  <pre><code>document.addEventListener('deviceready', function () {
  
    var notificationOpenedCallback = function(jsonData) {
      console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
    };
  
    window.plugins.OneSignal
      .startInit("XXXXXX-XXXX-XXX-XXXX-XXXXXXXXX") // &lt;- api id
      .handleNotificationOpened(notificationOpenedCallback)
      .endInit();
  
    OneSignal.push(function() {
      OneSignal.getUserId(function(userId) {
        console.log("OneSignal User ID:", userId);
      });
  
      OneSignal.getUserId().then(function(userId) {
        console.log("OneSignal User ID:", userId);
      });
    });
  }, false);
  </code></pre>