Kotlin: Subscribe to Firebase Cloud Messaging(FCM) Topic

115
May 10, 2022, at 8:40 PM

I've used the Android (Java) way of doing things before for subscribing to a topic

FirebaseMessaging.getInstance().subscribeToTopic("weather")...

But was looking at the Kotlin example

Firebase.messaging.subscribeToTopic("weather")...

I'm not finding how to get this class to show to be able to write it like the above.

I can get the Java way to show but not the Kotlin.

Anyone know what needs to be added to the Gradle or other to do this?

Thanks

Answer 1

My guess it that you forgot to add the Kotlin extensions, which means you only get the Java-level APIs.

To make the Kotlin extensions available, add the -ktx dependency to your Gradle file as shown in the documentation on setting up Kotlin.

Rent Charter Buses Company
READ ALSO
Lib Gdx what is the error and how to solve it?

Lib Gdx what is the error and how to solve it?

When I create a bundle, I get this errorWhen I create an apk or run directly from Android Studio, there are no errors

103
Android multi module project

Android multi module project

I'm trying to setup a multi-module project with bottom navigation fragments and hiltIs there any github project I can use to start my project faster?

144
Add AndroidTest build type for all flavors in whitelabel app

Add AndroidTest build type for all flavors in whitelabel app

I have a whitelabel Android app, that uses flavors to build the different variantsI have setup the application so that all variants are built with fastlane, and everything works correctly except when it comes to AndroidTest, and its usage to generate...

140