From 8d98af6b7165af620fbcef28c78b823239a22ab8 Mon Sep 17 00:00:00 2001 From: Andrey Bondarenko Date: Wed, 17 Feb 2021 22:01:55 +1000 Subject: [PATCH] change doc --- README.md | 26 +++++++++++++++++++ .../plugin/reactnative/AppMetricaModule.java | 5 +--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0378b6a..59dd551 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,32 @@ react-native-push-next library functionality is expanded [react-native-appmetric or `yearn add react-native-appmetrica-next` +## NEXT for Android + +# create file + +` +import com.google.firebase.messaging.FirebaseMessagingService; +import com.google.firebase.messaging.RemoteMessage; +import com.yandex.metrica.push.firebase.MetricaMessagingService; + +public class FirebaseMessagingMasterService extends FirebaseMessagingService { +@Override +public void onMessageReceived(RemoteMessage message) { +super.onMessageReceived(message); +// AppMetrica automatically recognizes its messages and processes them only. +new MetricaMessagingService().processPush(this, message); + + // Implement the logic for sending messages to other SDKs. + } + +} +` + +# Android manifest + +` ... ... ` + ## Usage ```js diff --git a/android/src/main/java/com/yandex/metrica/plugin/reactnative/AppMetricaModule.java b/android/src/main/java/com/yandex/metrica/plugin/reactnative/AppMetricaModule.java index 4711b85..d17b229 100644 --- a/android/src/main/java/com/yandex/metrica/plugin/reactnative/AppMetricaModule.java +++ b/android/src/main/java/com/yandex/metrica/plugin/reactnative/AppMetricaModule.java @@ -19,7 +19,6 @@ import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReadableMap; import com.yandex.metrica.YandexMetrica; import com.yandex.metrica.push.YandexMetricaPush; -import com.yandex.appmetrica.push.firebase.FirebasePushServiceControllerProvider; public class AppMetricaModule extends ReactContextBaseJavaModule { @@ -55,9 +54,7 @@ public class AppMetricaModule extends ReactContextBaseJavaModule { @ReactMethod public void initPush() { - // YandexMetricaPush.init(reactContext); - YandexMetricaPush.init(getReactApplicationContext(), - new FirebasePushServiceControllerProvider(getReactApplicationContext())); + YandexMetricaPush.init(reactContext); } @ReactMethod