Installation
Ensure you have completed the Prerequisites section before continuing.
- JavaScript
- iOS
- Android
- Node.js
- Python
- Ruby
If you're using npm:
npm install @dashx/browser
If you're using yarn:
yarn add @dashx/browser
Configure the DashX
client as early as possible in your application:
import DashX from '@dashx/browser'
DashX.configure({
publicKey: '<YOUR PUBLIC KEY>', // required
baseUri: '<YOUR BASE URI>', // optional
targetEnvironment: '<YOUR ENVIRONMENT>' // optional
})
The minimum supported version for iOS is 12.0. To set the Minimum SDK target:
- Open your iOS project in XCode
- Select your Target > General > Deployment Info > Ensure that the version is set to 12.0+
Using Cocoapods
- Update your Podfile:
platform :ios, '12.0' # must be 12 or higher
# ...
target 'YOUR_TARGET_NAME' do
# ...
pod 'DashX'
# ...
end
- Open Terminal in your project's root directory and run:
pod install
Using Carthage
- Specify the dependency in your
Cartfile
:
github "dashxhq/dashx-ios"
- Run the following command:
carthage update
Using Swift Package Manager
- In your Xcode project, go to File > Add Packages
- Paste the following URL in "Search or Enter Package URL":
https://github.com/dashxhq/dashx-ios.git
- Add Maven Central repository to your settings.gradle file:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// ...
mavenCentral()
}
}
- Add
dashx-android
as a dependency in your module-level build.gradle file:
dependencies {
// ...
implementation 'com.dashx:dashx-android:1.0.9'
}
- Enable Java 1.8 source compatibility if you haven't yet.
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
If you're using Android Studio, you should hit the Sync Now button that pops up after modifying build.gradle
.
DashX needs to be initialized as early as possible in your application's lifecycle, which is generally in an instance of the Android Application
class:
import android.app.Application;
import com.dashx.sdk.DashX;
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
DashX.configure(
context = this,
publicKey = "...", // required
baseURI = "...", // optional
targetEnvironment = "...", // optional
)
}
}
If your product uses multiple environments, a good practice is to:
- create
productFlavors
for each environment, - use
buildConfigField
to declare your DashX configuration, and then - use
BuildConfig
to pass your configuration as parameters.
If you're using npm:
npm install @dashx/node
If you're using yarn:
yarn add @dashx/node
const DashX = require('@dashx/node');
// Initialize DashX SDK
const dx = DashX.createClient({
publicKey: process.env.DASHX_PUBLIC_KEY,
privateKey: process.env.DASHX_PRIVATE_KEY,
});
The SDK can also be initialized with no parameters, dashx-node
will then look for these env variables DASHX_PUBLIC_KEY
and DASHX_PRIVATE_KEY
.
const DashX = require('@dashx/node');
// Initialize DashX SDK
const dx = DashX.createClient();
pip install dashx
Add this line to your application's Gemfile:
gem 'dashx'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install dashx
require 'dashx'
# Initialize DashX SDK
DashX.configure do |config|
config.public_key = ENV['DASHX_PUBLIC_KEY']
config.private_key = ENV['DASHX_PRIVATE_KEY']
end