Coder Social home page Coder Social logo

Comments (2)

amonkhepri avatar amonkhepri commented on June 25, 2024

Try updating gradle Firebase related implementations to current version

//firebase
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.6.0'

from firebase-firestore-chat-app.

nocturnalbeast avatar nocturnalbeast commented on June 25, 2024

This is because FirebaseInstanceIdService has been replaced by FirebaseMessagingService.

You'll need to update your build.gradle files in the app folder to reflect the newer versions first, like @Amunratis has mentioned.

    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-firestore:20.1.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.firebaseui:firebase-ui-auth:3.3.1'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    implementation 'com.firebaseui:firebase-ui-storage:3.3.1'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'

This is just similar to what he has mentioned, but the main modules you must upgrade are the core and the messaging modules.

After doing so, you'll need to modify the MyFirebaseInstanceIDService class by making it inherit the FirebaseMessagingService instead of the FirebaseInstanceIdService like so:

class MyFirebaseInstanceIDService : FirebaseMessagingService() {

Then replace the onTokenRefresh() function with the onNewToken() as given below:

    override fun onNewToken(token: String) {
        super.onNewToken(token)
        if (FirebaseAuth.getInstance().currentUser != null)
            addTokenToFirestore(token)
    }

from firebase-firestore-chat-app.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.