Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- App.push = (function(){
- var id = '[---App ID---]';
- var notificationOpenedCallback = function(jsonData) {
- console.log('didReceiveRemoteNotificationCallBack: ' + JSON.stringify(jsonData));
- };
- var init = function(customid, callback){
- id = customid ? customid : id;
- console.log('Initializing push');
- if(!window.cordova){
- return;
- }
- window.plugins.OneSignal.init(id, {googleProjectNumber: ""}, notificationOpenedCallback);
- // Show an alert box if a notification comes in when the user is in your app.
- window.plugins.OneSignal.enableInAppAlertNotification(true);
- getID(callback);
- };
- var getID = function(callback){
- console.log('Get push ids');
- window.plugins.OneSignal.getIds(function(ids) {
- console.log('getIds: ' + JSON.stringify(ids));
- if(callback){
- callback();
- }
- });
- };
- return {
- init:init
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement