Skip to content

Latest commit

 

History

History
72 lines (57 loc) · 3.34 KB

android_setup.md

File metadata and controls

72 lines (57 loc) · 3.34 KB

Android set-up required for Ost React Native SDK

1. Linking the Ost React Native SDK

Automatic Linking

react-native link @ostdotcom/ost-wallet-sdk-react-native

Manual Linking

  1. Open up ./android/app/src/main/java/[...]/MainApplication.java.
    • Add import com.ostwalletrnsdk.OstWalletRnSdkPackage; to the imports at the top of the file.
    • Add new OstWalletRnSdkPackage() to the list returned by the getPackages() method
  2. Append the following lines to ./android/settings.gradle:
    include ':ost-wallet-sdk-react-native'
    project(':ost-wallet-sdk-react-native').projectDir = new File(rootProject.projectDir, 	'../node_modules/ost-wallet-sdk-react-native/android')
    
  3. Insert the following lines inside the dependencies block in ./android/app/build.gradle:
    compile project(':ost-wallet-sdk-react-native')
    
    

2. Changing minSdkVersion in './android/build.gradle' file

Change the minSdkVersion to 22 in android/build.gradle

android {
    defaultConfig {
        minSdkVersion 22
        ...
        ...
        ...
    }
}

3. Create SDK configuration file

Create file ./android/app/src/main/assets/ost-mobilesdk.json with application specific configurations using the json below as an example

{
  "BLOCK_GENERATION_TIME": 3,
  "PIN_MAX_RETRY_COUNT": 3,
  "REQUEST_TIMEOUT_DURATION": 60,
  "SESSION_BUFFER_TIME": 3600,
  "PRICE_POINT_CURRENCY_SYMBOL": "USD",
  "USE_SEED_PASSWORD": false
}
  1. BlockGenerationTime: The time in seconds it takes to mine a block on auxiliary chain.
  2. PricePointTokenSymbol: This is the symbol of base currency. So its value will be OST.
  3. PricePointCurrencySymbol: It is the symbol of quote currency used in price conversion.
  4. RequestTimeoutDuration: Request timeout in seconds for https calls made by ostWalletSdk.
  5. PinMaxRetryCount: Maximum retry count to get the wallet Pin from user.
  6. SessionBufferTime: Buffer expiration time for session keys in seconds. Default value is 3600 seconds.
  7. UseSeedPassword: The seed password is salt to PBKDF2 used to generate seed from the mnemonic. When UseSeedPassword set to true, different deterministic salts are used for different keys.

NOTE: These configurations are MANDATORY for successful operation. Failing to set them will significantly impact usage.

Debug builds with Android 9 (API level 28)

Starting with Android 9 (API level 28), cleartext support is disabled by default. On the other hand, Ost Wallet Android Sdk leverages on Public Key Pinning to ensure the authenticity of a Ost Platform server's public key used in TLS sessions using TrustKit. As TrustKit can only be inititialized with application's network security configuration, sdk initialization fails. To work-around this issues, application needs to have TrustKit as a dependency and initialize it.

Please refer to Public Key Pinning Using TrustKit documentation.

Next Steps

  1. SDK Usage
  2. SDK Methods
  3. SDK Callbacks