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
final class ConnectivityStateManager { | |
... | |
private volatile ConnectivityState state = ConnectivityState.IDLE; | |
... | |
} |
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
public final class ManagedChannelImplBuilder extends ManagedChannelBuilder<ManagedChannelImplBuilder> { | |
... | |
static final long IDLE_MODE_DEFAULT_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(30); | |
static final long IDLE_MODE_MIN_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(1); | |
... | |
} |
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
val channel = AndroidChannelBuilder | |
.forAddress("127.0.0.1", 9090) | |
.context(androidContext) | |
.build() |
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
val channel = AndroidChannelBuilder | |
.forAddress("127.0.0.1", 9090) | |
.maxRetryAttempts(10) | |
.build() |
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
val channelWithKeepAlive = AndroidChannelBuilder | |
.forAddress("127.0.0.1", 9090) | |
.keepAliveTime(20, TimeUnit.SECONDS) | |
.keepAliveTimeout(5, TimeUnit.SECONDS) | |
.build() |
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
syntax = "proto3"; | |
package com.victorbrandalise; | |
service Bookstore { | |
rpc CreateBook(CreateBookRequest) returns (Book) {} | |
rpc ListBooks(ListBooksRequest) returns (ListBooksResponse) {} | |
} | |
message Book { |
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
val scope = CoroutineScope(Dispatchers.IO) | |
fun main() { | |
val channel = AndroidChannelBuilder | |
.forAddress("127.0.0.1", 9090) | |
.build() | |
val book = BookOuterClass.Book.newBuilder() | |
.setId(1) | |
.setTitle("gRPC In-Depth") |
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 const val CHANNEL_ID = "heads_up_alerts" | |
private const val CHANNEL_NAME = "Heads Up Alerts" | |
private val notificationManager = NotificationManagerCompat.from(context) | |
private fun createNotificationChannel() { | |
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return | |
val channel = NotificationChannel( | |
CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH |
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
const val NOTIFICATION_ID = 24756 | |
notificationManager.notify(NOTIFICATION_ID, createNotification()) |
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
class HomeActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityHomeBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
binding = ActivityHomeBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
} |
OlderNewer