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.

Issue on Android : FirebaseMessaging.getInstance().getToken() and FirebaseMessaging.getInstance().deleteToken();

See original GitHub issue

Question

My project was previously using the react-native-push-notification version 3.5.2. Today I upgraded the same to the latest version - 8.1.0. I also upgraded the @react-native-community/push-notification-ios to 1.10.1.

When I try to build the android app, I get the error : > Task :react-native-push-notification:compileDebugJavaWithJavac FAILED

The two main errors after this error are:

/Users/apple/Desktop/Push-Notifications/betterhalf-mobile-rn/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:140: error: cannot find symbol
      FirebaseMessaging.getInstance().getToken()
                                     ^
  symbol:   method getToken()
  location: class FirebaseMessaging
/Users/apple/Desktop/Push-Notifications/betterhalf-mobile-rn/node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotification.java:283: error: cannot find symbol
      FirebaseMessaging.getInstance().deleteToken();
                                     ^
  symbol:   method deleteToken()
  location: class FirebaseMessaging

My firebase packages are as follows:

    "@react-native-firebase/app": "^10.0.0",
    "@react-native-firebase/crashlytics": "^10.0.0",
    "@react-native-firebase/in-app-messaging": "^10.0.0",
    "@react-native-firebase/messaging": "^10.0.0",
    "@react-native-firebase/perf": "^10.0.0",

Entire error log in gist : https://gist.github.com/aditya-keri-betterhalf/8b026335e442e9774c6960b4879c8f06

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vliedelcommented, Dec 7, 2021
0reactions
erickcruscommented, Nov 30, 2022

Same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

FirebaseMessaging - Google
To delete the data, delete the token ( deleteToken ) and the Firebase Installations ID ( FirebaseInstallations.delete() ). To stop the periodic sending...
Read more >
Firebase Cloud Messaging - Handling logout - Stack Overflow
Okay. So I managed to do some testing and have concluded the following: deleteToken() is the counterpart of getToken(String, ...
Read more >
FCM getInstance().getToken() in Android is now deprecated ...
For current versions of the FCM library, FirebaseInstanceId class is no longer available, then I wrote how to fix it and still work...
Read more >
FirebaseMessaging.getInstance().getToken() - Android Forums
I don't know why the fcm token not generated. Please guide me, how to fix it. The below are my code snippet: FirebaseMessaging.getInstance()....
Read more >
Android – Firebase Cloud Messaging – Handling logout
getInstance().deleteToken(FirebaseInstanceId.getInstance().getId(), FirebaseMessaging.INSTANCE_ID_SCOPE). But I still receive the notifications to my ...
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