Skip to content

Latest commit

 

History

History
26 lines (24 loc) · 719 Bytes

README.md

File metadata and controls

26 lines (24 loc) · 719 Bytes

Wessager

Wessager is wear messager Communication between phone and wear in a simple way by using coroutines. No callback & Main-Safe

Dependencies

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "com.google.android.gms:play-services-wearable:$gms_wearable_version"

Usage

copy Wessager to your project

sample:

// get a token from phone or wear
launch {
    val token = Wessager.send(msg = "get token", waitResponse = true)
    updateToken(token)
}
...
// on another device
 override fun onMessageReceived(msg: String, sessionId: Long) {
        Wessager.send(msg = "token:xxx", waitResponse = false, sessionId = sessionId)
 }