For this tutorial, we will integrate SatisMeter native SDK’s for iOS and Android and use it from JS side of the app.
Let’s start with creating a react-native project,
npx react-native init rn_bridge_satismeter
First, we will integrate iOS SDK
You can refer to the documentation for iOS SDK integration here.
Open project on xcode.
open `rn_bridge_satismeter.xcworkspace` file
Let’s create a Cocoa Touch class RCTSatisMeter using xcode.
This will create 2 files inside: RCTSatisMeter.h and RCTSatisMeter.m
Add pod to your podfile
Update RCTSatisMeter.h file to look like this:
Update RCTSatisMeter.m file to look like this:
RCT_EXPORT_MODULEmacro, which exports and registers the native module class with React Native.
And we are done with SatisMeter sdk integration in ios.
Call SatisMeter.hook() from App.js
And run the app on iOS simulator,
npx react-native run-ios
We have successfully integrated the SDK on our iOS App : )
Let’s integrate the SDK on Android now,
You can refer to the documentation for Android SDK integration here.
Create SatisMeterModule.java & SatisMeterPackage.java
Update SatisMeterModule.java to look like this:
getName()to specify the native module’s name.
Update SatisMeterPackage.java to look like this:
Add package to MainApplication.java,
To register the
SatisMeterModule package, we must add
SatisMeterPackage to the list of packages returned in ReactNativeHost's
Add satismeter package to app/build.gradle,
We don’t need to do any changes on App.js, everything will work just fine.
And run the app on Android emulator,
npx react-native run-android
We have successfully integrated the SDK on our Android App too : )
Thanks for reading.
I hope you enjoyed this article and it helped you in some way.
More articles to come. Stay tuned.
You can find the code for this tutorial in this repo.
Also, find me on LinkedIn.