
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-native-apxor-sdk
Advanced tools
React Native wrapper for Apxor SDK. Please refer Plugins section to integrate other Apxor plugins.
Run the following command
$ npm install react-native-apxor-sdk --save
$ react-native link react-native-apxor-sdk
Open up android/app/src/main/java/[...]/MainActivity.java
import com.apxor.reactnativesdk.RNApxorSDKPackage;
to the imports at the top of the filenew RNApxorSDKPackage()
to the list returned by the getPackages()
method@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
...
new RNApxorSDKPackage(), <- ApxorSDK package
...
);
}
Append the following lines to android/settings.gradle
:
include ':react-native-apxor-sdk'
project(':react-native-apxor-sdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-apxor-sdk/android')
Run the command $ yarn add react-native-apxor-sdk
android/build.gradle
maven { url "http://repo.apxor.com/artifactory/list/libs-release-android/" }
maven { url "https://dl.bintray.com/apxor/apxor-android" }
android/app/build.gradle
: implementation 'com.apxor.androidx:apxor-android-sdk-core:2.7.9@aar'
Add the following meta-data
tag inside application
tag of AndroidManifest.xml
file:
<application ...>
...
<meta-data android:name="APXOR_APP_ID" android:value=[REPLACE_YOUR_APXOR_APP_ID_HERE] />
...
</application>
Add following dependencies in build.gradle file
// Add this to track uninstalls and send push notifications from Apxor dashboard
// Note: We don't support firebase-messaging >= 22.0.0 yet
implementation('com.apxor.androidx:apxor-android-sdk-push:1.2.5@aar') {
exclude group: 'com.google.firebase'
}
// Add these for Realtime Actions and Surveys
implementation 'com.apxor.androidx:apxor-android-sdk-qe:1.4.6@aar'
implementation 'com.apxor.androidx:apxor-android-sdk-rtm:1.7.5@aar'
implementation 'com.apxor.androidx:surveys:1.3.1@aar'
// Add this to track application crashes
implementation 'com.apxor.androidx:apxor-android-crash-reporter:1.0.5@aar'
// Helper plugin to create walkthroughs
implementation 'com.apxor.androidx:wysiwyg:1.2.0@aar'
// Add this to execute Client Functions
implementation 'com.apxor.androidx:apxor-cf:1.0.0@aar'
// Add this to log events without attributes at runtime
implementation 'com.apxor.androidx:jit-log:1.0.0@aar'
// Getting a "Could not find" error? Make sure that you've added
// Apxor's Maven repository to your root-level build.gradle file
Note:
If you are using
firebase-messaging >= 22.0.0
, use"com.apxor.androidx:apxor-android-sdk-push-v2"
instead of"com.apxor.androidx:apxor-android-sdk-push"
implementation('com.apxor.androidx:apxor-android-sdk-push-v2:1.2.5@aar') {
exclude group: 'com.google.firebase'
}
Create plugins.json file at android/app/src/main/assets/ folder
Paste the following JSON in that file
{
"plugins": [
{
"name": "rtm",
"class": "com.apxor.androidsdk.plugins.realtimeui.ApxorRealtimeUIPlugin"
},
{
"name": "crash",
"class": "com.apxor.androidsdk.plugins.crash.CrashReporterPlugin"
},
{
"name": "push",
"class": "com.apxor.androidsdk.plugins.push.PushPlugin"
},
{
"name": "surveys",
"class": "com.apxor.androidsdk.plugins.survey.SurveyPlugin"
},
{
"name": "wysiwyg",
"class": "com.apxor.androidsdk.plugins.wysiwyg.WYSIWYGPlugin"
},
{
"name": "cf",
"class": "com.apxor.androidsdk.plugins.cf.ApxorCFPlugin"
},
{
"name": "jitlog",
"class": "com.apxor.androidsdk.plugins.jitlog.ApxorJITLogPlugin"
}
]
}
If you have extended the FirebaseMessagingService
in your application, please use below code in your extends FirebaseMessagingService
class to receive Push notifications sent from Apxor dashboard
if (remoteMessage.getFrom().equals(YOUR_FCM_SENDER_ID)) {
// Your logic goes here
} else {
if (ApxorPushAPI.isApxorNotification(remoteMessage)) {
ApxorPushAPI.handleNotification(remoteMessage, getApplicationContext());
} else {
// Silent or Data push notification which you can send through Apxor dashboard
}
}
To Auto initialize SDK (Recommended), add the following inside your application
plist file.
Open your application's Info.plist as source code.
Copy paste the below piece of code, to create an entry for ApxorSDK.
<key>Apxor</key>
<dict>
<key>Core</key>
<string>{YOUR_APP_ID}</string>
<key>APXSurveyPlugin</key>
<true/>
<key>APXRTAPlugin</key>
<true/>
<key>APXWYSIWYGPlugin</key>
<true/>
</dict>
s.dependency 'Apxor-WYSIWYG', '1.0.84'
Note
The
APXWYSIWYGPlugin
is only for debug builds, make sure to remove it for production builds.
import RNApxorSDK from 'react-native-apxor-sdk';
// Syntax
RNApxorSDK.setUserIdentifier('user_id');
// Example
RNApxorSDK.setUserIdentifier('<some_user_id>');
// Syntax
RNApxorSDK.logAppEvent(event_name, properties);
// Example
RNApxorSDK.logAppEvent('ADD_TO_CART', {
userId: 'user@example.com',
value: 1299,
item: 'Sony Head Phone 1201',
});
// Syntax
RNApxorSDK.setUserCustomInfo(properties);
// Example
RNApxorSDK.setUserCustomInfo({
city: 'Hyderabad',
age: 12,
});
@react-navigation
, Apxor SDK automatically tracks screen navigation if you follow below mentioned stepsApxor's ApxNavigationContainer
is just a wrapper over NavigationContainer
which internally handles the route navigations (nested route navigations too) and take necessary actions within RNApxorSDK
To automatically track navigations, use ApxNavigationContainer
and pass the same props you pass to NavigationContainer
like below
import { ApxNavigationContainer } from 'react-native-apxor-sdk';
import { createStackNavigator } from '@react-navigation/stack';
const Stack = createStackNavigator();
function App() {
return (
<ApxNavigationContainer
theme={yourTheme}
linking={yourLinkingOptions}
fallback={yourFallbackNode}
{...others}
>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Details" component={DetailsScreen} />
<Stack.Screen name="FlatList" component={FlatListSample} />
</Stack.Navigator>
</ApxNavigationContainer>
);
}
// Syntax
RNApxorSDK.logNavigationEvent(screen_name);
// Example
RNApxorSDK.logNavigationEvent('LoginScreen');
FAQs
React Native Apxor SDK
The npm package react-native-apxor-sdk receives a total of 3,386 weekly downloads. As such, react-native-apxor-sdk popularity was classified as popular.
We found that react-native-apxor-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.