Плагин React-native Pushwoo sh не получает уведомления pu sh (Android) - PullRequest
0 голосов
/ 23 января 2020

Я следовал этому руководству (https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/react-native/integrating-react-native-plugin) на веб-сайте, но он просто не работает в моем проекте.

Когда я использую те же учетные данные инициализации в примере на GitHub я получаю уведомление.

Моя ошибка No task registered for key RNFirebaseBackgroundMessage

Я следовал примеру до буквы, поэтому не совсем уверен, что происходит. Я видел некоторые вещи в Интернете об этой ошибке, но, похоже, ничего не помогло.

Вот мой индекс. js file:

import App from './src/routes/routes';
import { name as appName } from './app.json';
import { setJSExceptionHandler, setNativeExceptionHandler } from 'react-native-exception-handler';
import firebase from 'react-native-firebase';

const reporter = (error) => {
    // Logic for reporting to devs
    // Example : Log issues to github issues using github apis.
    console.log(error); // sample
    firebase.crashlytics().log(error);
};

const errorHandler = (e, isFatal) => {
    if (isFatal) {
        reporter(e);
        Alert.alert(
            'Unexpected error occurred',
            `Error: ${(isFatal) ? 'Fatal:' : ''} ${e.name} ${e.message}
            We have reported this to our team ! Please close the app and start again!
            `,
            [{
                text: 'Close',
                onPress: () => {
                    BackHandler.exitApp();
                }
            }]
        );
    } else {
        firebase.crashlytics().log(e);
        console.log(e); // So that we can see it in the ADB logs in case of Android if needed
    }
};

setJSExceptionHandler(errorHandler);
setNativeExceptionHandler(exceptionString => { });

import Pushwoosh from 'pushwoosh-react-native-plugin';

AppRegistry.registerComponent(appName, () => App);

DeviceEventEmitter.addListener('pushOpened', (e) => {
    console.warn("pushOpened: " + JSON.stringify(e));
    alert(JSON.stringify(e));
  });

DeviceEventEmitter.addListener('pushReceived', (e) => {
console.warn("pushReceived: " + JSON.stringify(e));
// shows a push is received. Implement passive reaction to a push, such as UI update or data download.
});


  Pushwoosh.init({ "pw_appid" : "MY ID", "project_number":"MY NUMBER"});

  Pushwoosh.register(
    (token) => {
      console.warn("Registered for pushes: " + token);
      Pushwoosh.getPushToken(function(token) {
          console.warn("Push token: " + token);

          // Geolocation tracking example
          //PushwooshGeozones.startLocationTracking();
          //PushwooshGeozones.stopLocationTracking();
      });
    },
    (error) => {
      console.warn("Failed to register: " + error);
    }
  );

  Pushwoosh.getHwid((hwid) => {
    console.warn("Pushwoosh hwid: " + hwid);
  });```
...