Ng-Cordova と onesignal を使用しています。私はコルドバを使用し、ワンシグナルが成功しました。しかし、ng-cordova は正常に動作しません。my onesignal register code is in index.html I try app.run $ionicPlatform.ready(function() but is not working . My question is How get onesignal id after the register. And where write is my true code?
私の index.html
<script type="text/javascript">
document.addEventListener('deviceready', function () {
// Enable to debug issues.
// window.plugins.OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
var notificationOpenedCallback = function(jsonData) {
// alert('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
};
alert("deviceready");
window.plugins.OneSignal.init("******************",
{googleProjectNumber: "***********",autoRegister: true},
notificationOpenedCallback);
window.plugins.OneSignal.setSubscription(true);
window.plugins.OneSignal.enableNofiticationWhenActive(true);
window.plugins.OneSignal.registerForPushNotifications();
// Show an alert box if a notification comes in when the user is in your app.
window.plugins.OneSignal.enableInAppAlertNotification(true);
window.plugins.OneSignal.getIds(function(ids) {
$("#ids").val(ids.userId);
alert(ids.userId);
});
}, false);
</script>