A way to communicate with LinkSheet, allowing your app to see which domains LinkSheet will send to it and to request domains be selected.
Add JitPack to your Maven repos:
maven(url="https://jitpack.io")
Add the dependency:
implementation("com.github.1fexd:LinkSheetInterConnect:<VERSION>")
The LinkSheet
object has most of the needed utilities for connecting to LinkSheet.
To check if LinkSheet is installed, use isLinkSheetInstalled()
:
val linkSheetInstalled = with (LinkSheet) {
context.isLinkSheetInstalled()
}
To check if the installed LinkSheet supports the interconnect service, use supportsInterconnect()
:
val supportsInterconnect = with (LinkSheet) {
context.supportsInterconnect()
}
This function will also return false if LinkSheet isn't installed.
To bind to the LinkSheet service, use bindService()
.
In Kotlin, you can use the suspend
version of the function in a Coroutine scope to avoid using callbacks:
val connection = with (LinkSheet) {
context.bindService()
}
In Java, or if you don't have a suspend context available, you can use the callback version:
with (LinkSheet) {
context.bindService { connection ->
// Use the connection here.
}
}
When you bind to LinkSheet with the bindService()
function, a LinkSheetServiceConnection
is provided to you.
This implements all functions LinkSheet supports and adds a disconnect()
function that should be called when you're done communicating with LinkSheet.
LinkSheetServiceConnection
also implements ServiceConnection
. The disconnect()
function is just a convenient way to unbind LinkSheet.