react-native-firestack icon indicating copy to clipboard operation
react-native-firestack copied to clipboard

Android CloudMessaging: Cannot read property 'getToken' of undefined

Open studiobrain opened this issue 7 years ago • 2 comments

constructor() {
    console.log('UserStore', firebase.cloudMessaging)
    firebase.cloudMessaging.getToken().then((token) => {
      console.log('device token', token)
      this.deviceToken = token
    })
  }

the log returns an object:

CloudMessaging {firestack: Firestack, eventHandlers: Object, options: Object, requestedPermissions: Object}

however getToken() returns the error:

Possible Unhandled Promise Rejection (id: 0):
Cannot read property 'getToken' of undefined
TypeError: Cannot read property 'getToken' of undefined

Have the callbacks been resolved via the @ReactMethod, so that the js can participate in cloud messaging?

via: "react-native-firestack": "^2.3.9", "react-native": "0.42.0",

studiobrain avatar Apr 04 '17 16:04 studiobrain

@studiobrain this hasn't been implemented in this repo yet, but there are alternatives you can use.

Salakar avatar Apr 07 '17 17:04 Salakar

+1

grodriguez1983 avatar May 09 '17 16:05 grodriguez1983