react-native-fcm: "undefined is not an object" ANDROID PROBLEM

Hi, i try to install your component.

On iOS all works fine, but on Android when i call FCM.requestPermissions(); or FCM.getFCMToken().then(token => {}})

Error: undefined is not an object (evaluating 'RNFIRMessaging.requestPermissions')

I have this component installed previously but i dont think its relevant https://github.com/evollu/react-native-firebase-analytics

PD: I have import FCM from 'react-native-fcm';

media-20160919

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 15 (1 by maintainers)

Most upvoted comments

public class MainApplication extends Application implements ReactApplication {
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new FIRMessagingPackage()
      );
    }
}

android studio can help fix import stuff

import com.evollu.react.fcm.FIRMessagingPackage;

@sibelius Lol! My bad! Thanks! I havnt it. What i have to import to add this?

public class MainApplication extends Application implements ReactApplication {
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new FIRMessagingPackage()
      );
    }
}