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
/* | |
* Copyright 2020 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* https://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
import kotlinx.coroutines.* | |
fun main() = runBlocking { | |
val job = GlobalScope.launch { // launch a new coroutine and keep a reference to its Job | |
delay(1000L) | |
println("World!") | |
} | |
println("Hello,") | |
job.join() // wait until child coroutine completes | |
} |
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
# Purpose: Shell script to connect a USB connected device via adb over WiFi | |
# | |
# Author: Amanshu Raikwar | |
# | |
# Assumptions: | |
# 1. USB debugging is enabled in the Android device | |
# 2. The Android device is connected to the computer via USB | |
# 3. The Android device is connected to the same wifi as the computer | |
# 4. The Android device is accessible through port 5555 over the wifi network | |
# |
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
/* | |
* RxJava simple demonstration of subscribeOn() and observeOn() | |
*/ | |
println("Calling function : Thread = ${Thread.currentThread().id}") | |
Observable | |
.just(1) | |
.doOnNext { | |
println("OnNext : Val = $it : Thread = ${Thread.currentThread().id}") |
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
/* | |
* RxJava without any multi-threading | |
*/ | |
println("Calling function : ${Thread.currentThread().id}") | |
val obs = Observable | |
.just(1) | |
.doOnNext { | |
println("OnNext : Val = $it : Thread = ${Thread.currentThread().id}") |