Integrate with Expo based React Native app

This article provides information on how to integrate your Expo based React Native app with Blueshift's React Native plugin.

Expo is an open-source platform that you can use to develop native apps for Android, iOS, and the web with JavaScript and React. Blueshift's React Native Plugin is created using Native Modules. Hence to integrate your Expo based React Native app, you must add some code in the native Android and iOS projects.

Prerequsite

Before you can start to integrate, you must generate the native Android and iOS projects using expo prebuild.

Android apps

  1. Integrate the plugin by following the steps given in the Install and set React Native plugin documentation.
  2. Integrate Firebase messaging for Android to enable push notifications by completing the following steps:
    1. Download the google-services.json file from the Firebase project’s Project Settings tab and place it in the path: /android/app/google-services.json.
    2. Add the following dependency under the project-level build.gradle file’s dependencies section: classpath 'com.google.gms:google-services:4.3.15'
    3. Add the following plugin inside the app-level build.gradle file: apply plugin: "com.google.gms.google-services"
    4. Now register the Firebase messaging service of Blueshift SDK in the AndroidManifest file.
<service
  android:name="com.blueshift.fcm.BlueshiftMessagingService"
  android:exported="true">
  <intent-filter>
      <action android:name="com.google.firebase.MESSAGING_EVENT" />
  </intent-filter>
</service>

iOS apps

  1. Integrate the plugin by following the steps given in the Install and set React Native plugin documentation.
  2. Follow the steps in the Integrate your React Native iOS app documentation to configure and initialize the Blueshift iOS SDK in your project.