Skip to main content

Posts

Support in-app updates

Keeping your app up-to-date on your users’ devices enables them to try new features, as well as benefit from performance improvements and bug fixes. Although some users enable background updates when their device is connected to an unmetered connection, other users may need to be reminded to update. In-app updates is a Play Core library feature that introduces a new request flow to prompt active users to update your app. Add this in dependencies{ implementation ' com.google.android.play:core: 1.6 . 4 ' } In-app updates work only with devices running Android 5.0 (API level 21) or higher, and requires you to use Play Core library 1.5.0 or higher. After meeting these requirements, your app can support the following UX for in-app updates: Flexible Immediate   Flexible A user experience that provides background download and installation with graceful state monitoring. This UX is appropriate when it’s acceptable for the user to use the app while downloading th
Recent posts

IOT-Firebase-Python

Connecting raspberry with the firebase using the python. I will code here how to upload the images or some data to firesebase using python. Sample code to upload images and data to firebase is there in github : https://github.com/yuvaraj119/IOT-Firebase-Python  First install pyrebase from https://pypi.org/project/Pyrebase/ Now we are good to go with code. import pyrebase import uuid from uuid import getnode as get_mac import getpass import datetime import os config = { "apiKey":"", #get api key from firebase "authDomain":"", #firebase app auth url "databaseURL": "", #add yout db url from firebase where your data is gonna store "storageBucket": "" #storage bucket url from firebase storage } firebase = pyrebase.initialize_app(config) db = firebase.database() storage = firebase.storage() is_session=False #creating unique name for session and device uid_str = uuid.uuid5(uuid.NAM

Android Customized-FloatSeekBar

A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Placing focusable widgets to the left or right of a SeekBar is discouraged. SeekBar support only int values for progress: void setMax(int max) Set the upper range of the progress bar max. void setMin(int min) Set the lower range of the progress bar to min. void setProgress(int progress) Sets the current progress to the specified value. int getMax() Return the upper limit of this progress bar's range. int getMin() Return the lower limit of this progress bar's range. int getProgress() Get the progress bar's current level of progress. In some scenario we would need floating point seekbar progress, which is not supported by default in android. Here the floating seekbar which supports floating point value: You can download the full sample and library from https://github.com/yuvaraj119/Cus

Etcher - Burn. Better. Burn images to SD cards & USB drives, safely and easily.

I was searching for good image burner for writing SD card for Raspberry Pi this was first time i am gonna use Raspberry Pi and i don't wanna it to go in wrong way. I searched for tool which is easier and smarter which is the Etcher i come to know about this. https://etcher.io/ I liked the look of Etcher’s clean and simple interface which is platform independent works on any platform. Its simple 3 step interface:  STEP 1: You browse to the image file from your system. Select a drive SD card or USB drive.  Now lets hit the Flash button to start the burning image on SD card or USB drive. STEP 2:    Now wait for few minutes to burn the image on SD card or USB drive. Once its done it will start validating whether its burned correctly. STEP 3: Once the process has finished you have the option to burn the same image again or to choose a different image.   When selecting image files you can select IMG and ISO files as expected but also Zip files. This a

Kotlin Returns and Jumps

Returns and Jumps Kotlin has three structural jump expressions: return . By default returns from the nearest enclosing function or anonymous function . break . Terminates the nearest enclosing loop. continue . Proceeds to the next step of the nearest enclosing loop. All of these expressions can be used as part of larger expressions: val s = person.name ?: return The type of these expressions is the Nothing type . Break and Continue Labels Any expression in Kotlin may be marked with a label . Labels have the form of an identifier followed by the @ sign, for example: abc@ , fooBar@ are valid labels (see the grammar ). To label an expression, we just put a label in front of it loop@ for (i in 1..100) { // ... } Now, we can qualify a break or a continue with a label: loop@ for (i in 1..100) { for (j in 1..100) { if (...) break@loop } } A break qualified with a label jumps to the execution point right after the loop marked with that label. A contin

Kotlin Control Flow

Control Flow If Expression In Kotlin, if is an expression, i.e. it returns a value. Therefore there is no ternary operator (condition ? then : else), because ordinary if works fine in this role. // Traditional usage var max = a if (a < b) max = b // With else var max: Int if (a > b) { max = a } else { max = b } // As expression val max = if (a > b) a else b if branches can be blocks, and the last expression is the value of a block: val max = if (a > b) { print("Choose a") a } else { print("Choose b") b } If you're using if as an expression rather than a statement (for example, returning its value or assigning it to a variable), the expression is required to have an else branch. When Expression when replaces the switch operator of C-like languages. In the simplest form it looks like this when (x) { 1 -> print("x == 1") 2 -> print("x == 2") else -> { // Note the

Kotlin Basic Types

Basic Types In Kotlin, everything is an object in the sense that we can call member functions and properties on any variable. Some types are built-in, because their implementation is optimized, but to the user they look like ordinary classes. In this section we describe most of these types: numbers, characters, booleans and arrays. Numbers Kotlin handles numbers in a way close to Java, but not exactly the same. For example, there are no implicit widening conversions for numbers, and literals are slightly different in some cases. Kotlin provides the following built-in types representing numbers (this is close to Java): Type Bit width Double 64 Float 32 Long 64 Int 32 Short 16 Byte 8 Note that characters are not numbers in Kotlin. Literal Constants There are the following kinds of literal constants for integral values: Decimals: 123 Longs are tagged by a capital L : 123L Hexadecimals: 0x0F Binaries: 0b00001011 NOTE: Octal literals a