Как получать уведомления Firebase в фоновом режиме, используя React Native Script - PullRequest
0 голосов
/ 01 октября 2018

index.js:

   import bgNotification from './bgNotification'

   AppRegistry.registerHeadlessTask('RNFirebaseBackgroundMessage', () => 
   bgNotification);

build.gradle:

   implementation project(':react-native-firebase')
   implementation "com.google.android.gms:play-services-base:15.0.1"
   implementation "com.google.firebase:firebase-core:15.0.2"
   implementation "com.google.firebase:firebase-storage:15.0.2"
   implementation "com.google.firebase:firebase-messaging:15.0.2"
   implementation "com.google.firebase:firebase-auth:15.0.0"

bgNotification.js:

   import firebase from 'react-native-firebase';
   // Optional flow type
   import type { RemoteMessage } from 'react-native-firebase';

   export default async (message: RemoteMessage) => {
     return Promise.resolve();
   }

Пожалуйста, помогите мне найти проблему в приведенном выше коде.Существует другое решение, которое запускает приложение в фоновом режиме и выполняет требуемую задачу при получении уведомления.

...