Posts

Fundamentals of Dependency Injection and popular libraries in Android

Image
Dependency injection is quite interesting topic and to understand it perfectly it is very important to learn the basics of it and learn it in depth. So I am planning to explain it in two parts. This post will explain what dependency injection is, its benefit and different popular DI options which we can use in our Android projects. It seems little theoretical to you to grasp the basics. So let’s gets started… “With good basics you’ll have endless options” What is DI? Any business application is made up of two or more classes and these classes collaborate with each other to perform some operation. Traditionally, we create the instance of dependent class object and do the required operations. When applying Dependency Injection, the objects are given their dependencies at creation time by some external entity that coordinates each object in the system. It means dependencies are injected into objects. In other words, Dependency injection is a style of object ...

Local Broadcast, less overhead and secure in Android

Image
Broadcast receiver is an Android component which allows you to send or receive Android system or application events. All the registered application are notified by the Android runtime once event happens. It works similar to the publish-subscribe design pattern and used for asynchronous inter-process communication. For example, applications can register for various system events like boot complete or battery low, and Android system sends broadcast when specific event occur. Any application can also create its own custom broadcasts. Basics of broadcast Let’s discuss some basic concepts of broadcast receiver. Register Broadcast There are two ways to register broadcast receiver- Manifest-declared (Statically) : By this receiver can be registered via the AndroidManifest.xml file. Context-registered (Dynamically): By this register a receiver dynamically via the Context.registerReceiver() method. Receive Broadcasts To be able to receive a br...

Autoboxing, a little thing, can cause big problems for Android App Performance

Image
To ensure your app performs well across a wide variety of devices, you always try to use best practices. On that front memory optimization is often a demanding task. Most of the time we always think on the bigger side of it and miss the small thing that can add up to a big problem. Autoboxing is a topic that often goes unnoticed when talking about performance issues. Autoboxing is a great language feature, until you realize how much of your performance is being lost to its convenience. You cannot imagine a simple Autoboxing operations can easily tear through your Application’s memory. What is Autoboxing? Till JDK 1.4, when we work with primitive types, it requires repetitive work of converting the primitive types into wrapper classes and vice-versa. Let’s say if we want to create a List with Integers, we have to explicitly wrap them as Integer and we need to unwrap it to get int value. So since JDK 1.5, Conversion from primitive types to corresponding wrapper ...

Android O: Impact On Running Apps And Developer Viewpoint

Image
It’s been just about a year since Google released Android Nougat. In the next version of its Android operating system, it revealed the first developer preview of Android O (Hoping it’ll named Android Oreo) on 21 March 2017. In this article, we are going to discuss all the important features and changes of Android O from developer’s perspective. The Android O release will be known as Android 8.0. The final version of Android 8.0 will be out sometime in Q3 of 2017 and before that Google has plan to rollout DP #4. Based on DP #1, here are list of major behavioral changes which will impact on all currently running applications when run on Android O platform. ·        Background execution limits ·        Background location limits ·        Handles identifiers(Android ID) differently ·        Account Access ·     ...