Add the SDK
The first step in getting up and running with Nami in your App is to add it to your project. In this guide you'll find instructions for adding the Nami SDK to your project in
- Apple projects
- React Native projects for both iOS and Android
- Android projects
Apple
We support several options to get your project up and running with Nami in the Apple ecosystem. Also, check out our Github Repository.
Apple Requirements
The Nami Apple SDK supports
- iOS 11.3+
- iPadOS 13+
- Xcode 11+
CocoaPods
Add the following line to your Podfile
. We have an example Podfile in our repository if you do not currently have one.
Must be using CocoaPods 1.9.1+
The Nami SDK on Apple is distributed as an XCFramework and only works with CocoaPods 1.9.1 and higher.
pod "Nami", "2.9.4"
Then run the following command in your Terminal.
$ pod install
CocoaPods could not find compatible versions for pod "Nami"
If you receive this or a similar error, try running the command
pod update
and then re-runningpod install
.
Manual Setup
- Start by downloading the Nami framework from GitHub.
- Copy Nami.xcframework to your local project directory.
- Navigate to your application's Project settings page in Xcode select the General tab, and then scroll down until you find the Frameworks, Libraries, and Embedded Content section.
- Drag and drop the Nami.xcframework from the finder into the Frameworks, Libraries, and Embedded Content section.
- When this step is complete, your Xcode should look like this:
Now you are all set to start building for both the simulator and your devices with the Nami SDK in Xcode 11.
Android
Android Requirements
- Android SDK minimum version 26
- SDK builds target Android 12 (API version 31)
- SDK has been built with Java v8 and Kotlin v1.4.31
Our Android SDK is available via our Maven repository. Add the following code snippet to your project's build.gradle
to add the Nami SDK to your project.
repositories {
maven { url "https://nami-android.s3.amazonaws.com/" }
}
Then in the build.gradle
for your app add the following code, replacing the version number with whichever version of the Nami SDK you would like to run.
dependencies {
implementation "com.namiml:sdk-android:2.0.0"
}
Add compileOptions
for Java 8 compatibility in build.gradle
.
android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
React Native
The Nami SDK can be accessed from React Native via an NPM bridge module, that will link in the full native SDK and allow access to various Nami capabilities. The React Native bridge currently supports both Android and iOS. The code for the React Native bridge is also available on our Github.
This section includes platform-specific instructions for Apple and Android that may differ from the general Apple and Android instructions for adding the SDK.
React Native for iOS Requirements
The React Native bridge for iOS requires
- CocoaPods 1.9.1+
- React 16.8.0+
- React Native 0.61.0+
If you need help setting up your React Native development environment, you can find instructions here:
https://reactnative.dev/docs/environment-setup
.
To add Nami to your React Native project, start by adding the React Native bridge to your project with yarn or npm.
yarn add react-native-nami-sdk
npm install react-native-nami-sdk --save
React Native - Android
Modify your build.gradle
file to work with Nami ML.
- Edit the
build.gradle
file in your project, found atandroid/build.gradle
. - Add
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
to thebuildscript > depedencies
. - Set the
minSdkVersion = 21
inbuildscript > ext
. - Add the Nami ML maven repository with this code
maven { url("https://nami-android.s3.amazonaws.com/") }
to your project underallprojects > repositories
.
For a brand new React Native project, your build.gradle
file should look like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
maven { url("https://nami-android.s3.amazonaws.com/") }
}
}
Build and run your Android app.
- Open the project or
build.gradle
for your app in Android Studio. - Allow the gradle sync process to complete.
- Return to the command line and run the following command:
yarn run android
React Native - Apple
After running the yarn install
command above, take the following steps to build your app with Nami for Apple devices.
- Confirm that the minimum version of your iOS project is at least 11.0. You can find this in your Podfile located at
ios/Podfile
. For a brand new React Native project, the first few lines of your Podfile should look like the example below:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
cd ios && pod update
- You can either run
yarn run ios
or open your xcworkspace file and build the app in Xcode.
Xamarin
Our Xamarin iOS binding library is available on GitHub and you can find the latest framework file that needs to be included at
https://packages.namiml.com/NamiSDK/Xamarin/<v.v.v>/Nami.framework.zip
by replacing <v.v.v>
with the correct version of the binding library.
The best way to add Nami to your project is to fetch our package from NuGet.
NuGet using Visual Studio for Mac
- Right-click on the Packages item under your Xamarin iOS Project and select Manage Packages.
- Type NamiML into the search box.
- Select the NamiML.SDK package from the list of NuGet packages.
- Click the Add Package button.
NuGet using Visual Studio on Windows
- Right-click on the References item under your Xamarin iOS Project and select Manage NuGet Packages....
- Type NamiML into the search box.
- Select the NamiML.SDK package from the list of NuGet packages.
- Click the Install button to add the package to your project.
dotnet Command Line Interface
- Open terminal and navigate to the project directory.
- Type
dotnet add package NamiML.SDK
and hit enter.
Package Manager Console
- Select the Tools menu
- Click the NuGet Package Manager > sub-menu.
- Choose the Package Manager Console option from the sub-menu.
- Type in Install-Package NamiML.SDK and hit enter.
Updated over 2 years ago