Merge remote-tracking branch 'origin/rename-android-pkg'
This commit is contained in:
commit
bff63b4f16
@ -5,8 +5,6 @@
|
|||||||
# react-native-appmetrica
|
# react-native-appmetrica
|
||||||
React Native bridge to the AppMetrica on both iOS and Android.
|
React Native bridge to the AppMetrica on both iOS and Android.
|
||||||
|
|
||||||
**NOTE: Only iOS support for now. Feel free to send PR with Android support.**
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Setup [AppMetrica](https://tech.yandex.com/appmetrica/).
|
1. Setup [AppMetrica](https://tech.yandex.com/appmetrica/).
|
||||||
@ -38,4 +36,7 @@ AppMetrica.activateWithApiKey('...KEY...');
|
|||||||
// Sends a custom event message and additional parameters (optional).
|
// Sends a custom event message and additional parameters (optional).
|
||||||
AppMetrica.reportEvent('My event');
|
AppMetrica.reportEvent('My event');
|
||||||
AppMetrica.reportEvent('My event', { foo: 'bar' });
|
AppMetrica.reportEvent('My event', { foo: 'bar' });
|
||||||
|
|
||||||
|
// Send a custom error event
|
||||||
|
AppMetrica.reportError('My error');
|
||||||
```
|
```
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.aandrosov.AppMetrica">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.doochik.RNAppMetrica">
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.aandrosov.AppMetrica;
|
package com.doochik.RNAppMetrica;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
@ -41,6 +41,15 @@ public class AppMetricaModule extends ReactContextBaseJavaModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void reportError(String message) {
|
||||||
|
try {
|
||||||
|
Integer.valueOf("00xffWr0ng");
|
||||||
|
} catch (Throwable error) {
|
||||||
|
YandexMetrica.reportError(message, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void reportEvent(String message, @Nullable ReadableMap params) {
|
public void reportEvent(String message, @Nullable ReadableMap params) {
|
||||||
if (params != null) {
|
if (params != null) {
|
@ -1,4 +1,4 @@
|
|||||||
package com.aandrosov.AppMetrica;
|
package com.doochik.RNAppMetrica;
|
||||||
|
|
||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
import com.facebook.react.bridge.NativeModule;
|
import com.facebook.react.bridge.NativeModule;
|
@ -3,7 +3,7 @@ package com.rnappmetrika;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
|
||||||
import com.facebook.react.ReactApplication;
|
import com.facebook.react.ReactApplication;
|
||||||
import com.aandrosov.AppMetrica.AppMetricaPackage;
|
import com.doochik.RNAppMetrica.AppMetricaPackage;
|
||||||
import com.facebook.react.ReactNativeHost;
|
import com.facebook.react.ReactNativeHost;
|
||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
import com.facebook.react.shell.MainReactPackage;
|
import com.facebook.react.shell.MainReactPackage;
|
||||||
|
@ -22,8 +22,8 @@ RCT_EXPORT_METHOD(reportEvent:(NSString *)message parameters:(nullable NSDiction
|
|||||||
[YMMYandexMetrica reportEvent:message parameters:params onFailure:NULL];
|
[YMMYandexMetrica reportEvent:message parameters:params onFailure:NULL];
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(reportError:(NSString *)message reason:(NSString *)reason) {
|
RCT_EXPORT_METHOD(reportError:(NSString *)message) {
|
||||||
NSException *exception = [[NSException alloc] initWithName:message reason:reason userInfo:nil];
|
NSException *exception = [[NSException alloc] initWithName:message reason:nil userInfo:nil];
|
||||||
[YMMYandexMetrica reportError:message exception:exception onFailure:NULL];
|
[YMMYandexMetrica reportError:message exception:exception onFailure:NULL];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user