Cannot find symbol class FirebaseInstanceId in my android studio project

0

import com.google.firebase.iid.FirebaseInstanceId; ^ symbol: class FirebaseInstanceId location: package com.google.firebase.iid

The code is in my RNPushNotifications.java file and I have tried changing multiple versions of firebase core and messaging, but nothing seems to help.

PS: also tried solutions given in Cannot resolve symbol "FirebaseInstanceId"

android firebase push-notification
2021-11-24 05:24:30
1

0

This method and class is deprecated in the latest versions,now you can use FirebaseMessaging class to get the Device token, like this

      FirebaseMessaging.getInstance().getToken()
            .addOnCompleteListener(task -> {
                if (task.isSuccessful() && task.getResult() != null) {
                    sendFCMTokenToDatabase(task.getResult());
                }
            });

Here task.getResult() method will provide you with FCM token.

2021-11-24 13:22:41

Can you please tell me from where to import sendFCMTokenToDatabase.
tom_riddle

That was my method, you can ignore it.
Vaibhav Goyal

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................