Pressenger SDK for React Native
Installation
- Follow the steps of the official Google documentation to install Firebase Cloud Messaging into your app: https://firebase.google.com/docs/android/setup
- Add
classpath 'com.google.gms:google-services:4.3.3'
to your top-level build file (android/build.gradle) into the buildscript/dependencies section. - Add
apply plugin: 'com.google.gms.google-services'
to your project-level build file (android/app/build.gradle) afterapply plugin: 'com.android.application'
. - Copy the generated google-services.json to your android project directory (android/app).
- Add
- Install this package by
npm install react-native-pressenger-sdk --save
- Add
maven { url 'https://maven.pressenger.com' }
to your top-level build file (android/build.gradle) into the allprojects/repositories section. - Add
implementation 'com.pressenger:sdk:4.16.2'
to your project-level build file (android/app/build.gradle) into the dependencies section. - Add
<meta-data android:name="pressenger_groupid" android:value="...your group id goes here..." />
to your app manifest (android/app/src/main/AndroidManifest.xml) into the application section.
Usage
The SDK will be automatically initialized when the application starts, so without any coding you can send messages to all of the devices.
If you need topic management (subscribe to/unsubscribe from topic) then you can do it easily by
; PressengerSdk; PressengerSdk;