title: React Native Firebase 6 cloud messaging and Push notifications
body: <p>I'm working with react native and firebase 6 to send push notifications.
  I use the official documentations of the new version :
  <a href="https://invertase.io/oss/react-native-firebase/v6" rel="nofollow noreferrer">https://invertase.io/oss/react-native-firebase/v6</a></p>
  
  <p>I add native code for both android and ios to handle sending and receiving notifications </p>
  
  <p>In my AndroidManifest.xml :</p>
  
  <pre><code>&lt;!-- [START firebase_service] --&gt;
          &lt;service
              android:name=".java.MyFirebaseMessagingService"
              android:exported="false"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;!-- [END firebase_service] --&gt;
  </code></pre>
  
  <p>I did not create the MyFirebaseMessagingService .</p>
  
  <p>I AppDelegate.m i add some functions : </p>
  
  <pre><code>// Required for the register event.
  - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
  {
    [FIRMessaging messaging].APNSToken = deviceToken;
    [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
    NSLog(@"APNs device token retrieved: %@", deviceToken);
  }
  
  // Required for the registrationError event.
  - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
  {
    [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];
    NSLog(@"Unable to register for remote notifications: %@", error);
  }
  // Required for the localNotification event.
  - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
  {
    [RNCPushNotificationIOS didReceiveLocalNotification:notification];
  }
  </code></pre>
  
  <p>In my Component.js i get the token like this : </p>
  
  <pre><code>// Firebase
  import firebase from '@react-native-firebase/app'
  import messaging from '@react-native-firebase/messaging'
  
    // ----- COMPONENT DID MOUNT ---- //
    async componentDidMount () {
      // ====================================================== //
      // ====================================================== //
      // ====================================================== //
      const granted = messaging().requestPermission()
  
      if (granted) {
        console.log('User granted messaging permissions!')
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
        firebase
          .messaging()
          .getToken()
          .then(fcmToken =&gt; {
            if (fcmToken) {
              // user has a device token
              console.log('-------- FCM TOKEN -------')
              console.log(fcmToken)
              console.log(JSON.stringify(fcmToken))
              this._setItem(fcmToken)
            } else {
              // user doesn't have a device token yet
              console.log('error')
            }
          })
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
      } else {
        console.log('User declined messaging permissions :(')
      }
      // ====================================================== //
      // ====================================================== //
      // ====================================================== //
    }
    // ----- FIN COMPONENT DID MOUNT ---- //
  </code></pre>
  
  <p>I send POST request to <a href="https://fcm.googleapis.com/fcm/send" rel="nofollow noreferrer">https://fcm.googleapis.com/fcm/send</a> :</p>
  
  <pre><code>{
   "to" : "token",
   "notification" : {
   "body" : "un nouveau partage",
   "title" : "un partage de contact reçu",
   "priority" : "high",
   "vibration":true,
   "sound": "Enabled",
   "badge":1,
   "requireInteraction": true,
   "click_action": "fcm.ACTION.HELLO"
   },
   "data" : {
   "body" : "nouvelle opportunité",
   "title" : "un nouveau partage",
   "content_available" : true,
   "priority" : "high"
   } 
  }
  </code></pre>
  
  <p>I receive the notification for both android and ios but i can't handle the click action :</p>
  
  <p>I want to redirect to specific route when the user click on the notification .</p>