This file contains hidden or 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
| class ImageFileThread( | |
| private val mainHandler: Handler, | |
| private val onAvailableToSendMessage: Handler.() -> Unit | |
| ) : Thread() { | |
| private var handler: Handler? = null | |
| override fun run() { | |
| Looper.prepare() | |
| handler = Handler(checkNotNull(Looper.myLooper())) { msg: Message -> |
This file contains hidden or 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
| val mainHandler = Handler(Looper.getMainLooper()) { msg -> | |
| // do something with msg | |
| // Main Thread here!! | |
| true | |
| } | |
| val imageThread = ImageFileThread(mainHandler) { | |
| val message = Message().apply { | |
| data = bundleOf( | |
| "image_url" to "https://example.com/img.png" |
This file contains hidden or 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
| class MyCustomThread : Thread() { | |
| var handler: Handler? = null | |
| override fun run() { | |
| Looper.prepare() | |
| handler = Handler(checkNotNull(Looper.myLooper())) { msg: Message -> | |
| // do something with the received Message | |
| true | |
| } |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| ''' | |
| !!! Required adb PATH on env var !!! | |
| [Usage] | |
| Run with python: | |
| $ python3 send_push_or_deeplink.py | |
| or add exec permission | |
| $ chmod +x send_push_or_deeplink.py |
This file contains hidden or 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
| interface SendChannel<in E> { | |
| suspend fun send(element: E) | |
| fun close(): Boolean | |
| } | |
| interface ReceiveChannel<out E> { | |
| suspend fun receive(): E | |
| } | |
| interface Channel<E> : SendChannel<E>, ReceiveChannel<E> |
This file contains hidden or 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
| // create smart-reply instance | |
| val smartReply = FirebaseNaturalLanguage.getInstance().smartReply | |
| // message list | |
| val conversation = ArrayList<FirebaseTextMessage>() | |
| // add messages on conversation | |
| ... | |
| // get suggested messages |
This file contains hidden or 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
| val localMessage = FirebaseTextMessage.createForLocalUser("Hi, I'm local user.", | |
| System.currentTimeMillis()) | |
| val remoteUserId = "1234abcde" | |
| val remoteMessage = FirebaseTextMessage.createForRemoteUser("Hi, I'm remote user.", | |
| System.currentTimeMillis(), | |
| remoteUserId) |
This file contains hidden or 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
| android { | |
| // ... | |
| aaptOptions { | |
| noCompress "tflite" | |
| } | |
| } |
This file contains hidden or 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
| dependencies { | |
| // ML Kit Smart Reply | |
| implementation 'com.google.firebase:firebase-ml-natural-language:18.2.0' | |
| implementation 'com.google.firebase:firebase-ml-natural-language-smart-reply-model:18.0.0' | |
| } |
This file contains hidden or 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
| interface ApiService { | |
| @GET("/users/{username}") | |
| fun getUser(@Path("username") username: String): Call<User> | |
| } |
NewerOlder