question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onRegister function not calling in android

See original GitHub issue

I was trying to generate the token in android but the onRegister function wont fire. Did I missing something. here is my code

import React, {Component} from ‘react’; import PushNotification from ‘react-native-push-notification’;

export default class PushController extends Component{ componentDidMount(){ PushNotification.configure({ onRegister: function(token) { console.log( ‘jitender:’, token ); },

        onNotification:function(notification){
            console.log('NOTIFICATION:', notification);
        },
        requestPermissions:true,
        popInitialNotification:true
    })
}

render(){
    return null
}

}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bericp1commented, Mar 9, 2018

Thought I’d drop a note here that this issue also arises if – during the android setup – you add the XML snippet (3 <receiver>s and 2 <service>s) inside of the <activity> tag like I did on accident -_-. They need to be immediate children to the <application>.

The error that shows up in logcat in this scenario is:

W ActivityManager: Unable to start service Intent { cmp=com.goodbookey.mobile.dev/com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService (has extras) } U=0: not found
1reaction
centaurreadercommented, Dec 1, 2016

this occurs on iOS as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - GCM onRegistered not calling - Stack Overflow
I have written a code for GCM registration, but I don't know why I'm not getting any callback (onRegistered, onError) of GCMIntentService.
Read more >
Step by Step guide for Implementing Push Notifications in iOS ...
Ensure that the push notification feature is enabled. ... (optional) Called when Token is generated (iOS and Android). onRegister: function ...
Read more >
Push Notifications - Optimizely
onRegister callback will not be called until ... notification is unfortunately not very strict and is different between iOS and Android.
Read more >
react-native-push-notification - npm
PushNotification.configure({ // (optional) Called when Token is generated (iOS and Android) onRegister: function (token) ...
Read more >
Implementing React Native Push Notifications in Android Apps
We will be testing out the notification feature on an Android device, ... Called when Token is generated (iOS and Android) onRegister: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found