Friday, October 19, 2018

ROOM ORM on Sqlite database



Room persistence library is an object-relational mapping used on top of SQLite database.  Which is mainly introduced to save the app developer time on database. In olden day's every developer used to write 1000+ lines of code to create a database with multiple tables in it.

Google I/O 2017 has come up with ORM methodology in Android for SQLite, It saves the developer time by just using the Model(Pojo) classes a table's and DAO interface for CRUD operations.

ROOM is the part of android Jetpack, which is Android Software components can be used to build great Android Apps


Wednesday, October 17, 2018

What's new in Kotlin 1.3 and Kotlin/Native multiplatform

On watching online streaming KotlinConf 2018 Keynote, which I was expected to see only updates in terms of mobile apps, I become excited when I see they bring the multiplatform Kotlin/Native-1.3(Beta), which is really going to bring quite challenges to the mobile developers, Here some things which I am going explain in brief.

What're the Kotlin updates?
  1. 1.5+ million users as of October within 2years(Open source)
  2. Autoscaling backend for your mobile apps
  3. Write Kotline using your favorite JAVA framework and libraries 
  4. Use fully-managed MySQL/PostgreSQL or Firebase for your application database
  5. Use IntelliJ with Google Cloud Tools Plugins to add Google Cloud API libraries and deploy to App Engine 
Some of the top companies using the Kotlin
  1. Allegro Tech
  2. N 26
  3. American Express
  4. OLX Group
What changes in Mobile apps?
  1. Reduced the build time from 50sec to 36sec
  2. Multiplatform projects: iOS and Android









Saturday, October 13, 2018

Job Scheduler in Android API 21(5.0 Lolipop)

Currently, Android System has two main means to schedule tasks :

  1. AlarmManager
  2. JobScheduler API

The latest apps should use the JobScheduler API. When the system is optimizing based on memory, power, connectivity conditions, APPs can still schedule jobs.
JobScheduler always runs in main UI thread: This means we should use run JobScheduler on Thread or AsyncTask

Advantages :

  1. JobScheduler API helps the batch jobs when devices has more resources
  2. JobScheduler API can be used to schedule everything that is not time critical for the user.
  3. The Android System can combine jobs so that battery consumptions can be reduced.
  4. It helps them during the application restart
  5. JobManager makes handling uploads easier as it handles automatically unreliability of the network.


When to use JobScheduler :
  1. Tasks that require WIFI or Data Connection
  2. Tasks that are not critical or not facing
  3. Tasks that should be running on a regular basis as batch where the time is not critical.
How to use JobScheduler

Thursday, August 16, 2018

Whats new in Android Pie 9.0

                                      

A New Way to Rotate Phone
Android has come up with the latest functionality to rotate horizontally with simple tap on botton icon. Same icon can be used to rotate back to vertical


Adaptive Battery
Digital Wellbeing
Google has released a new app on play store which monitors the hours of user spending times on every app so the user can adapt the best way to use the phone.


Revamped User Interface
Google is working on introducing material design 2 usage guidelines and themes to improve the user interface

Ban Annoying Notifications

Gesture Navigation

Removes the recent apps overview button and replaces the original home button with a pill that can slide up to show recent apps or slide right to quickly switch between apps

Monday, August 6, 2018

Sunday, July 15, 2018

Top Topics to know in SWIFT




                             
Observer V/S Delegates in SWIFT


Delegates are one to one communication and whereas an observer is having one and many other places to notify that observer through the code, from many places. In Observer its quite difficult to keep the record of every notifier, timing issues and maintain code and its hard to keep record of every notifier

LifeCycle of Views



Here are the different life cycle called whenever user loads the views on screen



Automatic Reference Counting and Retain Lifecycle


Favourite Framework










Thursday, May 31, 2018

Android App Bundle for bigger size APK's

The new app publishing format, the Android App Bundle, is an improved way to package your app. The Android App Bundle lets you more easily deliver a great experience in a smaller app size, allowing for the huge variety of Android devices available today. You don’t need to refactor your code to start benefiting from a smaller app.
Google Play’s new app serving model, called Dynamic Delivery, then uses your app bundle to generate and serve optimized APKs for each user’s device configuration, so they download only the code and resources they need to run your app. You no longer have to build, sign, and manage multiple APKs to support different devices, and users get smaller, more optimized downloads.

Monday, May 28, 2018

Flutter App for Android and iOS(Flutter Development)

To begin developing the apps using flutter, please have look into the following steps

  • Install the flutter plugin from Android Studio Preference > Plugins > Search key "Flutter"
  • Restart the Android Studio after successful install
  • To start developing the Complete Flutter app, download the flutter SDK
  • To download the flutter SDK click on new flutter project > Dropdown option to Install SDK
  • Choose the directory where you want to install SDK, wait until it installs.
  • Click finish >








Thursday, May 10, 2018

Android Jetpack

                   

         


Google has announced the Android Jetpack in May 2018  to accelerate the mobile app development.
Android Jetpack is the next generation of android components, with the help of support library.
backwards compatibility and immediate updates -- to a larger set of components, making it quick and easy to build robust, high quality apps.

What jetpack does
see the pic


Android Jetpack Components includes
  • Work Manager
  • Paging
  • Navigation
  • Slices

Android jetpack designed to work well with Kotlin, saving you even more code with Android KTX. 
Key area's of architecture component of jet pack



Each of these jetpack components is individually adaptable and they built to work well together.

Next is architecture component which is designed such way to resolve the developer pain point, some of them like lifecycle management, data persistence.
                  


Three new architecture component is seen below image


  

Paging facilitates gradual on-demand data loading from local or network data source allowing apps to work with large datasets including support recycler view.





Navigation provides the framework to build app flows that compile with android design guidelines with proper behavior for up and back button.

 Support for
  1. Deep linking 
  2. Automated fragment transactions
  3. Overflow Menu
  4. Navigation Drawer
  5. Bottom Navigation show in above pic
This is combined with the powerful graphical editor included 
In Android studio Navigation allows us to visualize, design and test app navigation graph
shown below pic



  





Work Manager makes it easy to schedule one-off or periodic asynchronous tasks.
Tasks can executes in order, Parallel or even more configurations.


Its also easy to query for the state of tasks and constraints, such as requiring unneeded network or charging Perhaps most importantly work manager takes care of compatibility issues, so you know that no matter what platform the user is on tasks are scheduled efficiently and system wide health in mind 

shown pic below





UI layer includes 

  1. Animaton & transitions 
  2. Layout
  3. Emoji
  4. Fragments
  5. TV library 
  6. Wear library 
  7. Auto library  are now the part of Jetpack
    Shown pic below








                                         










Behavior includes support for evolving android areas 

  1. App notifications
  2. Permissions
  3. Sharing
  4. Slices

Jetpack adds supports Slices, which allows your app to exposed templatized pieces of itself  to integrate with other apps such as Google search and assistant
shown pic below





Foundation includes

  1. Appcompat 
  2. Libraries for automated testing 
  3. And new ANdroid KTX Kotlin extensions

    Which makes Android development with Kotlin more concise, idiomatic and modern









credit src: https://www.youtube.com/watch?v=r8U5Rtcr5UU&index=1&list=PLWz5rJ2EKKc9mxIBd0DRw9gwXuQshgmn2

Android KTX



How to migrate existing java files to Kotlin ?

Here are the steps


  1. Android Studio Menu -> Code -> Convert Java File to Kotlin FileHere is how the functions appears once you convert Java
  2. For Threads & Handler make sure you use inner classes instead function because Kotlin throw a warning saying handler leak,


     

  3. Here is the example code how to use the Handler and thread

    var mIncomingHandler = Handler(IncomingHandlerCallback())

    internal inner class IncomingHandlerCallback : Handler.Callback {
    
        override fun handleMessage(message: Message): Boolean {
    
            swipe_refresh_layout.isRefreshing = false        if (message.what == GetCountryFactsThread.GETCOUNTRYFACTSTHREAD_SUCCESS) {
                val countryFactRespo = message.obj as String
                mCountryModel = ResponseManager.parseCountryFactsRespo(countryFactRespo)
    
                updateAdp(mCountryModel!!)
    
            } else if (message.what == GetCountryFactsThread.GETCOUNTRYFACTSTHREAD_FAIL) {
                //Write code handle if any session expiry            showSnackBar(resources.getString(R.string.no_internet))
            }
            return true    }
    }


    You can call it as below inside the onCreate method of activity

    GetCountryFactsThread(this, mIncomingHandler).start()











Google I/O 2018 Updates



                 Here are the Day 1 key highlights of Google I/O 2018   

*Waymo wants to make self-driving future a reality for everyone. Waymo cars have covered 6 million miles on public roads so far and have done over 5 billion miles in simulation.

* Big push for Google Lens. Google Lens will now be integrated into the Maps app, starting next week. It can now recognize and understand words. You can point your camera to an object and search for quick results. You can even search for those objects on e-commerce stores and buy them directly from Google Lens.

*Google Maps will now use VPS- Visual Positioning System to show exact directions. You can use the camera within Google Maps to get exact directions and landmarks.

*AI will be at the core of Google Maps now. A new tab called "For You" is being added to Maps. It will show recommendations of cafes, restaurants in the nearby areas. A new Group Planning feature on Maps will allow people to suggest and vote on a dinner location without having to leave the Maps app

*Android P Beta announced. Will available from May 8.

* Android P will set time limits to apps and will suggest you to take breaks from your mobile. A new Do Not Disturb mode will keep away all distractions- notifications, vibrations, etc. YouTube will have a deep link which will tell you the total watch time across mobile and desktop. Also, people have a habit to spend hours on the mobile right before bed. A new Wind Down mode will help users sleep better.

*Android P will have a digital well-being feature via Android dashboard. This will give insights on:
How many times you have unlocked?
How many notification have you received?
How much time have you spent on a particular app?
*Auto-rotate is now improved. A new rotation icon will popup beside the navigation icons to let you choose whether you want to actually rotate the screen or not for apps which are otherwise always used on portrait mode like Gmail. This will prevent accidental auto-rotate, which is frustrating sometimes.

*Google announces ML Kit for developers who are not much proficient on machine learning. The ML Kit will offer image, text, barcode and face recognition among others. There's a new system navigation. It is more gesture based natively.

*Android P is the first version of Android to highlight and pay attention digital well-being. Android P is all about simplicity,intelligence and digital well-being. It will leverage machine learning and artificial intelligence to take care of obvious settings on the phone like App prediction, adaptive brightness, adaptive battery and more.
*World's most popular operating system-- Android-- turns 10.

*The new Google News is here. You will get a briefing of the top five stories along with latest local stories. Google News will use machine learning to understand your news preference and will show stories accordingly. There is a new feature called 'Full Coverage'. This will show all relevant stories on a particular story from different sources. Also, ' Subscribe will Google' will allow you to access your paid content everywhere on Google's platform.

* Android dashboard will take care of digital well-being. It will understand your habits, focus on what matters and will tell you to switch-off apps and spend time with family. For example, if you watch too much of YouTube or any other app, the Android dashboard will suggest you to take a break and talk to your family or friends.

Post credit : www.gadgetsnow.com 



Friday, April 13, 2018

Tuesday, April 10, 2018

Swift Data Types



                       




Data Types:
As we discussed in the previous lesson, about variable and variable we have seen that, when we try to assign the String to Int type it was showing error message cannot assign, Here what String and Int are?.

Let discuss then
As shown and described in the above image, different types of datatypes in Swift, commonly used. Reason why there are many datatypes? Is this because system stores different types of data differently.



As we see in above picture variable that we declared as 'str'  and it is declared as to store only data of type string 'Hello, playground test' by a system.

To declare the variable we basically use
var str = "my test home"  here str assumes it should hold data of type string


The other way to declare is 

Saturday, April 7, 2018

Swift Variables, Constants

Variables: In swift, a variable holds some data, now its data could be a value, it could be a reference to an object or it can even point to a function.

Variable has a couple of distinct parts, let's break it down, them here



var str = "Hello, playground"

Variable need to be declared before they can be used, so this 'var' keyword is used to declare a new variable, following the var keyword you have the variable name 'str' that's it.

Now taking look at the whole line, what we have on the right-hand side there, that's some data,  we didn't say that variable hold some data, Here = sign in between variable name and piece of data that mean assignment operator.  That means assigning that str with data.



In above line, the playground shows the error because the data is not matching.
Let's start learning about the data types.

Before starting data types, let's discuss briefly naming conventions, naming variable we usually follow the camelcase.


Constants: Like the variable except it can't be reassigned new data after the first assignment.
Uses the 'let' keyword instead




Why would I or everyone use constants, if it more limited it's in functionality, instead if I declare everything in the variable I have all the flexibility I want.

Well, there are a couple of reasons why you would want to use constants, when making sense, for one thing, it helps computer works little more efficiently because it knows exactly what that constant will be and that not going to change.

Next chapter Data Types

Thursday, March 29, 2018

Flutter in Native Apps

                     

Flutter has some of the interesting features for native apps, the developer can easily use Flutter to enhance the UI experience.


Flutter is an open-source mobile application development SDK created by Google.

It is used to develop applications for Android and iOS, as well as being the primary method of creating applications for Google Fuchsia.


Google's mobile UI framework for crafting high-quality native interface on iOS and Android in record time.

Flutter works with existing code, is used by developers and organizations around the world, and is the free and open source.  

Wednesday, February 14, 2018

Kotlin getting started and Coding conventions

                  

How to initialise 
the class in Kotlin
Standard class CLASSNAME : PARENTCLASS, INTERFACE{
}
Example :
class SelectPicActivity: GalleryActivity, CallBackInterface{
}


How to initialise/declare the variable in Kotlin

private var uriString : String? =null
private var mCurrentPath = ""
private var REQUEST_IMAGE_PIC = 2
private var REQUEST_IMAGE_SELECT = 1


How to create method/function in Kotlin

Standard :
fun methodName(): Return{
}
Example : fun getFileName() : String{
//Write your code here var = "sd/test/stpe.jpeg"
return var
}

How to initialise the Arraylist/collections 

val mylist: ArrayList<T> = ArrayList<T>() //Add elements to mylist mylist.add("text")
println(mylist)
Continued

Wednesday, January 31, 2018

Face recognition in android using microsoft face API's

                            

Microsoft has given various API's for object recognition, extract the rich information from an image and process the visual data. Gives back image description, tagging, color, category and level of confidence. Some the services given by MicroSoft for object detection are.



1.  Analyse an image

2. Read text in an image



3. Preview Handwritten text from an image

4. Recognise the celebrities and landmarks

5. Analyse the video near in real time

6. Generate a thumbnail. 


Lets start learning some little deep into the above concept and how to use them, taking a sample android app.
Here is the sample app screen shot(ss)

                    
For sample app code please visit this here

Step to set up above app are

1. Download code from link

2. Click here and create a Microsoft azure account or login with Linkedin 

3. Click on get API key for  Computer vision API

4. Once you successfully enabled the API, on dashboard of azure account

    user would be able see the following information
 

   End point : http.....
   Key 1 : **********************
   Key 2 : 
**********************

Put the subscription inside the string file in android studio, and run the app.




Android app for FACE RECOGNITION

               

To set up the face recognition app, please follow the following steps

1 . Download the code from link

Monday, January 8, 2018

How to add Google Assistant to Existing app(Create our own assistant app with Google assistant API's)


                             

Kotlin Assistant app has many features to build, as per our business needs.
Some of them are

1. We can localize the app language



2. Customise the app for our business needs ex: E-Commerce, Healthcare Assistant

3. Customise the app for Families
Customise