Created
November 5, 2018 02:17
-
-
Save ricardoogliari/3c7c81be52b8c87bbaa6307d74d251e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val PUB_SUB_STRATEGY = Strategy.Builder().setTtlSeconds(Strategy.TTL_SECONDS_MAX).build() | |
private val PUB_OPTIONS = PublishOptions.Builder() | |
.setStrategy(PUB_SUB_STRATEGY) | |
.setCallback(object : PublishCallback() { | |
override fun onExpired() { | |
"Experid message".toast(this@MainActivityK); | |
} | |
}) | |
.build() | |
fun share(view: View) { | |
val buffer = StringBuffer() | |
buffer.append(edtFacebook.text.toString() + " ") | |
buffer.append(edtTwitter.text.toString() + " ") | |
buffer.append(edtLinkedin.text.toString() + " ") | |
buffer.append(edtPhoto.text) | |
message = Message(buffer.toString().toByteArray()) | |
Nearby.getMessagesClient(this) | |
.publish(message!!, PUB_OPTIONS) | |
.addOnSuccessListener(this) { aVoid -> Log.e(TAG, "sucesso: $aVoid") } | |
.addOnFailureListener(this) { e -> Log.e(TAG, "sucesso: $e.localizedMessage") } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment