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.4.1'
}
- 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
Link Initialization Params
While you must include the Link Token in your initialization of the PinwheelFragment
and attach event listeners as shown above, there are additional parameters available to customize your implementation:
handleInsets
defaults to true, but if set to false will prevent the Pinwheel SDK from handling the screen bezels on its own. This is very rarely needed.
useDarkMode
defaults to false, but if set to true will render Link in dark mode. Use this in combination with whatever mechanism you use to track whether your app is rendering in dark mode for a more consistent user experience.
Example of the full params:
val isDarkMode = true // Determine this from your app logic
val pinwheelFragment = PinwheelFragment.newInstance(token, handleInsets = true, useDarkMode = isDarkMode)
Maintenance
Pinwheel regularly releases improvements to this SDK. You should update to the latest version of the Android SDK at least quarterly to ensure the best product performance.
Updated about 6 hours ago