Manspof
Manspof

Reputation: 357

react native onesignal android push token is null

I'm using react-native-onesignal and I'm getting push token is null. enter image description here

 async componentDidMount() {
    const { currentState } = AppState


    OneSignal.init(ONESIGNAL_APP_ID)
    OneSignal.configure();

    OneSignal.registerForPushNotifications();
    OneSignal.addEventListener('received', this.onReceived)
    OneSignal.addEventListener('opened', this.onOpened)
    OneSignal.addEventListener('ids', this.onIds)
}
    onReceived = (notification) => {
    console.log("Notification received: ", notification)
}

onOpened = (openResult) => {
    console.log('Message: ', openResult.notification.payload.body)
    console.log('Data: ', openResult.notification.payload.additionalData)
    console.log('isActive: ', openResult.notification.isAppInFocus)
    console.log('openResult: ', openResult)
}

onIds = (device) => {
    console.log('Device info: ', device)
}

in addition in onesignal website under users I get the error google play services library error enter image description here

Upvotes: 0

Views: 1588

Answers (1)

Raj Gupta
Raj Gupta

Reputation: 260

You should replace ONESIGNAL_APP_ID with the app id from your onesignal account (can be found in settings -> keys & id's tab after logging in to onesignal account)

Upvotes: 2

Related Questions