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

Unable to get Android device token through registerRemoteNotificationsRegistered

Open kd4g opened this issue 4 years ago • 11 comments

I am using the following versions and followed all the steps outlined in https://wix.github.io/react-native-notifications/docs/installation-android

react-native-notifications": "^4.2.4" "react-native": "0.68.0",

registerRemoteNotificationsRegistered callback is not getting called after Notifications.registerRemoteNotifications(). So I am unable to get device token.

Here is the code snippet:

  Notifications.events().registerRemoteNotificationsRegistered(event => {.
      console.log(" Device Token Received" + event.deviceToken);
  }
  );
  Notifications.events().registerRemoteNotificationsRegistrationFailed((event) => {
      console.error(event);
  });

  Notifications.registerRemoteNotifications();

I ensured all changes are done to build.grade, gradle.settings as outlined in the document.

Any details about why callback is not called will be helpful.

Thanks!

kd4g avatar Apr 20 '22 05:04 kd4g

I am having the same problem right now. Any solutions or workarounds?

ErkanGorgulu avatar May 05 '22 08:05 ErkanGorgulu

+1

abuzzell avatar May 05 '22 12:05 abuzzell

Same on IOS device

moonbe77 avatar May 24 '22 04:05 moonbe77

Has anyone manage to resolve this issue yet? or have a workaround?

robfrancis avatar Jun 17 '22 06:06 robfrancis

Hmm, how to fix it :(

Anamcoollzz avatar Jun 21 '22 00:06 Anamcoollzz

I am having the same issue.

Notifications.events().registerRemoteNotificationsRegistered( (event) => { 
  // Code execution never reaches this point 
  console.log("registerRemoteNotificationsRegistered - deviceToken:", event.deviceToken, ); 
});

react-native: 0.68.2 react-native-notifications: 4.3.1

Bilal-Abdeen avatar Jun 29 '22 02:06 Bilal-Abdeen

Same issue here, any progress??

aljimsondev avatar Jul 26 '22 04:07 aljimsondev

In case it's helpful to anyone else, updating settings related to Google FCM fixed this issue for me. I was clued in by this comment and re-downloaded the google-services.json file. I also updated some of the gradle code based on what's in the docs. After updating all of that info, the token started magically appearing and the function body was now accessible.

My guess is the callback isn't run unless a valid token is present, which may not be returned if Google FCM isn't set up correctly.

"react-native": "0.67.4",
"react-native-notifications": "^4.2.4",

ls-andrew-borstein avatar Aug 02 '22 21:08 ls-andrew-borstein

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Sep 08 '22 21:09 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Sep 17 '22 00:09 stale[bot]

I'm getting stuck on this issue too.

"react-native": "0.69.7",
"react-native-notifications": "4.3.5"

nguyendinhdoan avatar Jul 12 '23 15:07 nguyendinhdoan