Skip to content

Instantly share code, notes, and snippets.

View paulkugaev's full-sized avatar

Paul Kugaev paulkugaev

  • Brest
View GitHub Profile
@maxost
maxost / SmsReceiver.kt
Created September 5, 2017 02:40
Kotlin: sms receiver and rx bus in Android
data class Sms(val phone: String, val text: String)
object SmsBus {
private val bus by lazy { PublishSubject.create<Sms>() }
fun incomingSms(): Observable<Sms> = bus
fun postSms(sms: Sms) = bus.onNext(sms)
}