React Native SDK Setup
Integrating the SDK in your mobile application
Follow the steps below to successfully integrate the SDK.
Step 1
Create an .npmrc file in the project repository to access the rn-cards-sdk. Copy the following content to the .npmrc file created
|
|
Step 2
Install the SDK using following command:
|
|
Platform Specific Setup
Perform the following steps to complete the platform specific setup for your application
Android
Step 1
Add the dependency on the private Maven Repo. This will help you to get access to all the native code for Cards SDK. Add the following code under the allProjects section of project level build.gradle.
|
|
You can get your username and password from App Center’s SDK details page.
Step 2
Enable data binding by adding the following line under the android section of app level build.gradle file.
|
|
Step 3
Exclude the Kotlin modules from packaging options. This can be done by adding the following code snippet to the android settings in app level build.gradle.
|
|
Step 4
Add following permissions to the AndroidManifest.xml file.
|
|
Step 5
Enable multi-dex by adding the following line under defaultConfig in the app level build.gradle file.
|
|
Step 6
Add the assets, config, collections and fonts provided in the SDK integration doc or app-center in the android folder.
Step 7
Add ‘jcenter()’ to the repositories under project level build.gradle. This is needed by Facebook react native 0.64.0 itself.
|
|
Step 8(Optional troubleshooting step)
In-case you face multi-dex issues, you may wish to tweak the memory settings a little. This can be done by adding following lines to gradle.properties file.
|
|
iOS
Step 1
In the podfile, add the following snippet
|
|
Step 2
Add the assets, config(supercardSdk.plist) and the local collection files for theme, templates & shopHook configs in the app target.
Step 3
run ‘pod install’ in ExampleApp/ios/ directory and then run ‘react-native run-ios’ in the root folder or build the project from xcode.
SDK initialisation
Initialise the cards SDK using the following code
|
|
SDK Authentication & Setup
Authenticate and setup the SDK using the following piece of code
|
|