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