Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

IOS Never fire the registration event #659

Closed
cmarrero01 opened this issue Feb 29, 2016 · 3 comments
Closed

IOS Never fire the registration event #659

cmarrero01 opened this issue Feb 29, 2016 · 3 comments

Comments

@cmarrero01
Copy link

Hi,

I have a problem on IOS devices, the notification is not showing... I have working the plugin on IONIC. and this is my code:

var conf = {
        android: {
          senderID: "****************",
          "icon": "icon",
          "iconColor": "black"
        },
        ios: {
          senderID: "****************",
          gcmSandbox: true,
          alert: "true",
          badge: true,
          sound: 'false'
        },
        windows: {}
      };

 var push = PushNotification.init(conf);
        console.log(push);

push.on('registration', function(data) {
          console.log("Registration",data);
        });

        push.on('notification', function(data) {
          console.log(data);
        });

        push.on('error', function(e) {
          console.log(e);
        });

The registration event never fired, so, i can't get the token for send the notification to the device.

This is my payload notification from node.js

var message = new gcm.Message({
                data: {
                    "title": "Test",
                    "icon": "icon",
                    "message": "Messate test.",
                    "priority": 2,
                    "style": "picture",
                    "picture": "http://www.bolsamania.com/cine/wp-content/uploads/2015/07/216.jpg",
                    "summaryText": "TEST",
                    "image": "www/img/icon.png"
                }
            });

This is a Small Log from xcode debug:

2016-02-29 18:52:29.057 MDZOL[319:41152] PushPlugin skip clear badge
2016-02-29 18:52:29.330 MDZOL[319:41152] Resetting plugins due to page load.
2016-02-29 18:52:32.049 MDZOL[319:41152] Finished load of: file:///var/mobile/Containers/Bundle/Application/077C920A-A1D3-483E-9974-E4905D713923/MDZOL.app/www/index.html#/tab/home
2016-02-29 18:52:32.471 MDZOL[319:41152] Ionic Core: plugins are ready
2016-02-29 18:52:32.474 MDZOL[319:41152] From device:  56d4b7d2408aba331cf821c7
2016-02-29 18:52:32.474 MDZOL[319:41152] Push instance {}
2016-02-29 18:52:32.484 MDZOL[319:41152] idfa class missing, won't collect idfa
2016-02-29 18:52:32.485 MDZOL[319:41152] THREAD WARNING: ['UniversalAnalytics'] took '10.420898' ms. Plugin should use a background thread.

If you see, the push instance is {}, so, I don't know what is the problem really.

Best
C

@cmarrero01
Copy link
Author

I solve the issue making a handler for init funciton..

/**
       * Initialized plugin
       */
      function initialized(){
        if(window.cordova && window.cordova.plugins){
          console.log("PushNotifications instance");
          pushNot = PushNotification;
        }
        return pushNot;
      }

@fredgalvao
Copy link
Collaborator

You should wait for the deviceready instead.

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants