change doc

This commit is contained in:
Andrey Bondarenko 2021-02-17 22:01:55 +10:00
parent 8525ca41e5
commit 8d98af6b71
2 changed files with 27 additions and 4 deletions

View File

@ -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
`<application> ... <service android:name=".FirebaseMessagingMasterService" android:enabled="true" android:exported="false"> <intent-filter android:priority="100"> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter> </service> <service android:name="com.yandex.metrica.push.firebase.MetricaMessagingService" tools:node="remove"/> ... </application> `
## Usage
```js

View File

@ -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