Search…
⌃K
Links

SDK Connect

SDK connect is a service that allows you to connect your app remotely to the SDK using bluetooth , WiFi.

Initialize

  1. 1.
    Add gradle dependency by adding the following code to the your Android App build.gradle
dependencies {
implementation "io.nearpay:nearpay-connect:0.0.13"
}
2.Create single instance of NearPay object with context wherever you need.
Kotlin
Java
val nearpay = NearPay(this, AuthenticationData.UserEnter, Locale.getDefault(), Environments.SANDBOX)
nearPay = new NearPay(this, AuthenticationData.UserEnter.INSTANCE, Locale.getDefault(), Environments.SANDBOX);
3.create nearpay connect object and add NearPay object to it
Kotlin
Java
val nearpayConnect = NearpayConnect(this,nearPay)
nearpayConnect = new NearpayConnect(this,nearPay);

Show()

  • show(): display a view with current state and option to connect with two different method (bluetooth and websocket) and disconnect.
nearpayConnect.show();

Disconnect()

  • disconnect(): return true if there is a session to disconnect or attempt to new connect to stop. return false otherwise.
nearpayConnect.disconnect()

getSession():

  • getSession(): return current session or null..
nearpayConnect.getSession()
Find session data here