firebasereact-nativereact-native-fcm

How to send push notification to react native android app using FCM


I am trying to build react native(0.59.9) android app with firebase push notification(FCM - ^16.2.4). I used this Doc https://github.com/evollu/react-native-fcm! . After add google-service.json file and gradle dependencies , it gave errors.

Task :react-native-fcm:generateDebugBuildConfig FAILED

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ':react-native-fcm:generateDebugBuildConfig'. Unable to delete directory '.......\node_modules\react-native-fcm\android\build\generated\source\buildConfig\debug\com\evollu\react' after 10 attempts

Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


Solution

  • I think you are going for a wrong component to install. Of course first delete your current react-native-fcm component. Then it is enough to follow the steps below for installing firebase on react native:

    https://rnfirebase.io/docs/v5.x.x/installation/initial-setup

    and then continue with this link for configuration of android:

    https://rnfirebase.io/docs/v5.x.x/installation/android

    Also this link is a very good tutorial:

    https://medium.com/@anum.amin/react-native-integrating-push-notifications-using-fcm-349fff071591