GuidesAPI ReferenceChangelog
Log In

Android SDK

Installation

The Pinwheel Android SDK is available via Maven Central Repository.

You can find the source code for the Android SDK here.

Maven Central Repository

To install the SDK using the Maven Central Repository

  1. Add mavenCentral to your app's build.gradle repositories block
repositories {
    mavenCentral()
}
  1. Add the package to your dependencies:
dependencies {
    implementation 'com.getpinwheel:pinwheel-android:3.0.1'
}
  1. Sync your Android gradle project and the library should be ready to use.

Usage

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

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

You can find the type definitions here.