add getToken

This commit is contained in:
Andrey Bondarenko 2021-02-15 17:59:08 +10:00
parent d8f32092e8
commit 052c8cf31c
4 changed files with 12 additions and 5 deletions

View File

@ -83,6 +83,7 @@ dependencies {
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation 'com.yandex.android:mobmetricalib:3.18.0'
implementation "com.yandex.android:mobmetricapushlib:1.10.0"
implementation "com.android.support:support-compat:28.0.0"
implementation 'com.android.installreferrer:installreferrer:1.1.2'
implementation "com.google.firebase:firebase-messaging:21.0.0"
implementation "com.google.android.gms:play-services-base:17.5.0"

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 {
@ -54,9 +53,12 @@ public class AppMetricaModule extends ReactContextBaseJavaModule {
@ReactMethod
public void initPush() {
// YandexMetricaPush.init(reactContext);
YandexMetricaPush.init(reactContext,
new FirebasePushServiceControllerProvider(reactContext));
YandexMetricaPush.init(reactContext);
}
@ReactMethod
public void getToken(Promise promise) {
promise.resolve(YandexMetricaPush.getToken());
}
@ReactMethod

View File

@ -70,6 +70,10 @@ export default {
}
},
getToken(){
return AppMetrica.getToken();
},
reportUserProfile(config: UserProfileConfig){
AppMetrica.reportUserProfile(config);
},

View File

@ -1,7 +1,7 @@
{
"name": "react-native-appmetrica-next",
"title": "Yandex AppMetrica React Native Plugin && AppMetricaPushSDK (fireBase CloudMessage)",
"version": "1.0.9",
"version": "1.0.10",
"description": "React Native plugin for AppMetrica analytics tool",
"main": "index.js",
"scripts": {