Showing posts from January, 2021

ADB over Wi-Fi

  To debug the behavior of your application while an accessory is plugged in, you can't use ADB through a USB cable. In this case, to debug applications, you need to link your device to ADB over Wi-Fi. Steps to configure the ADB connection over Wi-Fi Connect the device and the computer to the same Wi-Fi network. If the computer is connected to VPN, disconnect from it. The device can be on VPN. Plug the device into the computer with a USB cable to configure the connection On the computer command line type:  adb tcpip 5555 On the computer command line type:  adb shell ip addr show wlan0  and copy the IP address after the "inet" until the "/". You can also go inside the Settings of the device to retrieve the IP address in Settings → About → Status. On the computer command line type:  adb connect ip-address-of-device:5555 You can disconnect the USB cable from the device and check with  adb devices  that the device is still detected. adb over wifi

Setting up Graphql Server

This tutorial is based on  Install node and npm. If you don't have them installed do the following 1 and 2:     1. Install homebrew from     2. Install node and npm using homebrew Create a new folder named graphql-server-example cd into it. setup node project using the command: npm init --yes This creates a package.json file. Install apollo-server and graphql   using: npm install apollo-server graphql Create an empty index.js file with command touch index.js Add the following content to the file: const { ApolloServer , gql } = require ( 'apollo-server' ); // A schema is a collection of type definitions (hence "typeDefs") // that together define the "shape" of queries that are executed against // your data. const typeDefs = gql ` # Comments in GraphQL strings (such as this one) start with the hash (#) symbol. # This "Book" type defines the queryable field

Asynchronous programming in Android

 Asynchronous programming in Android can be done in various ways. Two of them are: 1. Using callback 2. Using coroutines Below is the example of using callback: Below is the example of using coroutine: ... Note that suspend function can only be called either from a  coroutine or from another suspend function. Here GlobalScope implements CoroutineScope and launch is a coroutine builder which is an extension function of CoroutineScope. Coroutine A  coroutine  is an instance of suspendable computation. It is conceptually similar to a thread, in the sense that it takes a block of code to run that works concurrently with the rest of the code. However, a coroutine is not bound to any particular thread. It may suspend its execution in one thread and resume in another one. Coroutines can be thought of as light-weight threads // Sequentially executes doWorld followed by "Hello" fun main() = runBlocking {     doWorld()     println("Done") } // Concurrently executes