Android SDK
Installation
The Pinwheel Android SDK is available via the Maven Central Repository.
Maven Central Repository
To install the SDK using the Maven Central Repository
- Add
mavenCentral
to your app'sbuild.gradle
repositories block
repositories {
mavenCentral()
}
- Add the package to your dependencies:
dependencies {
implementation 'com.getpinwheel:pinwheel-android:3.1.2'
}
- Sync your Android gradle project and the library should be ready to use.
Configuration
Some platform integrations may require camera access for verification purposes. Ensure the following permission is included in your AndroidManifest.xml
:
<uses-permission android:name="android.permission.CAMERA" />
Usage
PinwheelFragment
PinwheelFragment
The Pinwheel Android SDK provides the PinwheelFragment
that takes linkToken
as an argument.
import com.underdog_tech.pinwheel_android.PinwheelFragment
// fetch link token from server
val pinwheelFragment = PinwheelFragment.newInstance(token)
// show fragment
PinwheelEventListener
PinwheelEventListener
To listen for the events coming from Link, implement PinwheelEventListener
. Then simply provide the instance of the listener to PinwheelFragment
by setting the pinwheelEventListener
field.
val callbacks = object: PinwheelEventListener {
override fun onSuccess(result: PinwheelResult) {}
override fun onLogin(result: PinwheelLoginPayload) {}
override fun onError(error: PinwheelError) {}
override fun onExit(error: PinwheelError?) {}
override fun onEvent(eventName: PinwheelEventType, payload: PinwheelEventPayload?) {}
}
val linkToken: String = // The Link token created using the `POST /v1/link_tokens` endpoint.
val pinwheelFragment = PinwheelFragment.newInstance(linkToken)
pinwheelFragment.pinwheelEventListener = callbacks
Updated 15 days ago