add pushSDK for Android
This commit is contained in:
parent
c54ba7d4d2
commit
35dda6dbdf
@ -82,6 +82,7 @@ dependencies {
|
||||
//noinspection GradleDynamicVersion
|
||||
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.installreferrer:installreferrer:1.1.2'
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.yandex.metrica.YandexMetrica;
|
||||
import com.yandex.metrica.push.YandexMetricaPush;
|
||||
|
||||
public class AppMetricaModule extends ReactContextBaseJavaModule {
|
||||
|
||||
@ -50,6 +51,11 @@ public class AppMetricaModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void initPush() {
|
||||
YandexMetricaPush.init(reactContext);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void reportUserProfile(ReadableMap configAttributes) {
|
||||
YandexMetrica.reportUserProfile(Utils.toYandexProfileConfig(configAttributes));
|
||||
|
10
index.js
10
index.js
@ -6,7 +6,7 @@
|
||||
* https://yandex.com/legal/appmetrica_sdk_agreement/
|
||||
*/
|
||||
|
||||
import {NativeModules} from 'react-native';
|
||||
import {NativeModules, Platform} from 'react-native';
|
||||
|
||||
const {AppMetrica} = NativeModules;
|
||||
|
||||
@ -62,6 +62,14 @@ export default {
|
||||
AppMetrica.activate(config);
|
||||
},
|
||||
|
||||
initPush(token = ''){
|
||||
if(Platform.OS === 'android') {
|
||||
AppMetrica.initPush();
|
||||
} else {
|
||||
AppMetrica.initPush(token);
|
||||
}
|
||||
}
|
||||
|
||||
reportUserProfile(config: UserProfileConfig){
|
||||
AppMetrica.reportUserProfile(config);
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "react-native-appmetrica-next",
|
||||
"title": "Yandex AppMetrica React Native Plugin",
|
||||
"version": "1.0.2",
|
||||
"title": "Yandex AppMetrica React Native Plugin && AppMetricaPushSDK (fireBase CloudMessage)",
|
||||
"version": "1.0.3",
|
||||
"description": "React Native plugin for AppMetrica analytics tool",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -15,6 +15,9 @@
|
||||
"yandex",
|
||||
"appmetrica",
|
||||
"metrica",
|
||||
"pushSDK",
|
||||
"push",
|
||||
"sdk",
|
||||
"analytics",
|
||||
"tracking",
|
||||
"react-native",
|
||||
|
@ -17,4 +17,5 @@ Pod::Spec.new do |s|
|
||||
|
||||
s.dependency "React"
|
||||
s.dependency 'YandexMobileMetrica', '3.12.0'
|
||||
s.dependency 'YandexMobileMetricaPush', '0.8.0'
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user