Get Id onesignal cordova plugin

1

I'm having trouble getting the onesignal device id.

I'm trying to use the following method:

var getId = function(){
window.plugins.OneSignal.getIds(function(ids) {
  alert('getIds: ' + JSON.stringify(ids));
});
}

Before that I'm starting the onesginal and are receiving notifications normally.

 window.plugins.OneSignal
.startInit("APP_ID")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();

On the console is giving this error:

  

Refused to execute inline event handler because it violates the following Content Security Policy directive: "default-src 'self' data: gap: link 'unsafe-eval' ". Either the 'unsafe-inline' keyword, the hash ('sha256 -...'), or a nonce ('nonce -...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.

    
asked by anonymous 26.02.2017 / 15:27

1 answer

0

Resolved, when added this tag in html solved the problem

<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; img-src * data: 'unsafe-inline'">
    
26.02.2017 / 17:00