Skip to main content

Quick Start - Mobile Apps

Android

The Android SDK allows you to seamlessly open the Ramp Network widget directly inside your app using WebViews. Your app will be able to receive events about the purchase made inside the widget.

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}

Add this to your module's build.gradle file:

dependencies {
...
implementation 'com.github.RampNetwork:ramp-instant-sdk-android:v0.3.0'
}

Add this in your AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

<application ... >
// ...
<activity
android:name="network.ramp.instantsdk.ui.bank.BankActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@style/RampInstant.NoActionBar" />
<activity
android:name="network.ramp.instantsdk.ui.rampinstant.RampInstantActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@style/RampInstant.NoActionBar"></activity>
// ...
</application>

Example Integration Code

// ...
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_deposit.*
import network.ramp.instantsdk.R
import network.ramp.instantsdk.facade.RampInstantSDK


class DemoActivity : AppCompatActivity() {

private lateinit var widget: RampInstantSDK

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_deposit)

buyWithRampButton.setOnClickListener {
widget = RampInstantSDK(
this,
swapAsset: "ETH",
swapAmount: "1500000000000000000", // 1.5 ETH in wei
userAddress: "user blockchain address",
hostLogoUrl: "https://yourdapp.com/yourlogo.png",
hostAppName: "Your dApp",
webhookStatusUrl: "https://my.domain/callback/123/"
url = "https://app.demo.ramp.netework",
)
widget.show()
}
}
}

IOS

The IOS SDK allows you to seamlessly open the Ramp Network widget directly inside your app using WebViews. Your app will be able to receive events about the purchase made inside the widget.

Overview

The Ramp Network iOS SDK consists of two main types: RampInstantConfiguration and RampInstantManager.

RampInstantConfiguration contains all the information necessary for Ramp Network to initialize. Configuration details can be found here.

RampInstantManager is the main class. It allows to present the RampInstant widget, listen for events, and log debug information.

  • init(configuration: RampInstantConfiguration): create instance of RampInstantManager with configuration of your choice
  • presentWidget(on viewController: UIViewController, animated: Bool): display RampInstant widget on any view controller

Example Integration Code

To start using Ramp Network in your app, simply create a Configuration instance with parameters of your choice, then instantiate the RampInstantManager with the Configuration instance. Now you can present it anywhere!

// ...
import RampInstant

class ViewController: UIViewController {

var rampInstantManager: RampInstantManager?

// ...

@IBAction func showRampInstantAction(_ sender: UIButton) {
let configuration = RampInstant.Configuration(
hostLogoUrl: "https://assets.ramp.network/misc/test-logo.png",
hostAppName: "Example App Name",
userAddress: "user blockchain address",
swapAsset: "ETH",
swapAmount: "1500000000000000000", // 1.5 ETH in wei
url: "https://app.demo.ramp.network/"
)

rampInstantManager = RampInstantManager(configuration: configuration)
rampInstantManager!.presentWidget(on: self, animated: true)
}

// ...
}