Search
⌃K
Links

Android SDK Proxy

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-proxy:0.0.6'
}
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 port = 8080
val nearpayProxy = NearpayProxy(this,nearPay,port)
int = 8080;
nearpayProxy = new NearpayProxy(getApplication(), nearPay,null,port);

Show()

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

Disconnect()

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

getSession():

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