How To Get an FCM Device Token in Android (Updated for 2021)

How To Get an FCM Device Token in Android (Updated for 2021)

The old class for retrieving tokens is deprecated. Let’s look at the newer one. Learn how To Get an FCM Device Token in Android (Updated for 2021).

I really don’t like it much when there is some task to do with a deadline and there’s old code everywhere and all of it is deprecated, resulting in no specific answers online.

That’s when you work for the community and not for any job.

Directly coming to the point: Google deprecated Firebase's FirebaseInstanceIdService class and I didn’t know that (until last night) as the last time I wrote an FCM service was a year and a half ago. The application code base I got to modify in order to fetch the FCM device token had the deprecated class, and I recognized it as a correct one. Actually, there were two code bases I got, and both had the same non-working service class.

I looked online for answers but no luck. Then I read a comment on a question on Stack Overflow about FirebaseInstallations, and that’s when the fun started.

I knew the functions but not how to reach there: FirebaseInstallations was the way. I tried different methods in it and got the whole thing working.

kotlin

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire Dedicated Kotlin Developer - WebClues Infotech

Request a free quote for custom web and mobile apps development, Enterprise solutions, IoT Solutions, AR/VR Development, Blockchain and chatbot services. Feel free to get in touch.

How to Develop an Android App with Kotlin?

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Top Kotlin Android App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Top-notch Kotlin App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Kotlin or React Native | React Native vs Kotlin Performance Comparison

This blog provides quick analysis to decide whether to opt for Kotlin or React Native to build robust and secure mobile application.