Topic
Android
40 articles

Android Download file with Data URL
What is a Data URL? Data URLs are the type of URL scheme that is used to embed usually small types of files. In this URL, inline files are prefixed with the data: MIME type. data:[<mediatype>][;base64],<data> To download files having Data URLs inside Android: Firstly, we need to get an extension of the file from […]

Download the file with blob URL in Android WebView
What is the Blob URL? Blob URLs can only be generated by the browser with use of internal mapping and used within the current document while it’s open which means it is valid for the same session (ie. the life of the page/document). The blob URL looks like this: blob:http://example.com/550e8400-e29b-41d4-a716-446655440000 Below is the sample HTML […]

Key Terminologies in Android Enterprise
Android Enterprise is a Google-led initiative to enable the use of Android devices and applications in a workspace. This program offers APIs and tools for developers to integrate support of Android devices into the EMM (enterprise mobility management) or UEM (Unified Endpoint Management) solutions. The following are the key terms associated with Android Enterprise. This […]

How to avoid detach of Android Debugger while debugging Android Process?
OVERVIEW: Recently, I came across this problem many times where I attached the debugger to the Android Process, debug breakpoints were hit and I started evaluating some values or doing step over or step into debugging and suddenly, App isn’t responding dialog comes and debugger detaches from the process. To avoid detaching of the debugger […]

How to prevent Status Bar Expansion in Android 12 & above devices?
OVERVIEW : Recently, I came across an issue where the reflections used for collapsing status bar were not working from Android 12. When I tried to find alternative solutions, I got one using Accessibility Service in Android. Reflections used for collapsing status bar : statusBarManager.getMethod(“collapsePanels”); is not working from API 31 since it is hidden. […]

Introduction to Cookie Testing
1.Cookie Testing is mainly used to test the cookies that are saved in the web browser.2.When ever a web application is being accessed by the use of a server then The term cookie can be defined as the portion of data saved in the form of text in the browser history.3. It is used to […]

Android 13-New Enterprise Features
Android 13’s latest features help to boost Android Enterprise business with its new enhanced security upgrades to protect users’ privacy, easier ways to manage work and personal profiles, and user controls and platform improvements. So, let’s explore more into each of these areas: Enhanced Security and Privacy The integrated security and privacy settings page offers […]

How to programmatically get android launcher wallpaper in your app
There are multiple ways to achieve the goal of displaying the current system wallpaper as the application background. All are mentioned below : 1. By Using Windowmanager class It is the easiest way to use system wallpaper in which we can get a drawable object of system wallpaper image using WindowManager class of Android and […]

How to speed up the startup of your Android app using Jetpack’s startup library?
As an app or library developer, we may need to initialize the components at the app startup. One solution is initializing your components inside the application class one after the other. Another smart solution that libraries Work Manager or Firebase are using is to define content providers but below are the problems with the Content […]

Configure trusted Certificate Authorities and Certificate Pinning
Apps by default trust the pre-installed system Certificate Authorities (CA), but if someone wants to configure custom CAs in order to use self-signed certificates or certificates issued within a company or to limit the set of CAs or to trust additional CAs not included. This is accomplished by Android’s Network Security Configuration feature, which allows […]

Strict Mode in Android
What is Strict mode? As we know it’s not safe to perform a heavy operation on the main thread it will be a bad user experience and sometimes show ANR also. To prevent such things Strict mode will be helpful. A strict mode is a developer tool that helps to identify usage of disk and […]

How to install an application in a Zebra device using StageNow?
There are multiple ways of installing an application on devices like downloading from Play Store, Using ADB to install apk files, etc. But for Zebra devices there is an unique way to install an application using StageNow. StageNow is a tool developed by Zebra which provides a full control of the device to users. Using […]

Generate DumpState logs On Samsung Android Devices
Capture dumpstate logs on the Samsung devices: An issue or bug in software can cause the system to fail or behave in an unintended way. Whenever a critical issue is observed or found by the QA team, it is important for them to reproduce the issue and share the required logs with the app developers […]

How to extract APK file of installed application in Android programmatically
Step 1 : Get the path of the installed application Step 2 : Store the Apk file in required folder

How to enable/disable Google Play Protect in Android
What Is Google Play Protect? Google Play Protect scans malware using Machine Learning.It is a mobile threat protection service built into Android devices that scans and verifies over 50 billion apps everyday.Google Play Protect removes the harmful apps.It warns you about harmful apps that violate Unwanted Software Policy by hiding or misrepresenting important information. Google […]

Android Studio and its Features
What is Android Studio ? Android Studio is an IDE for developing applications for android os for Android phones, tablets, watches, and tvs. Android studio is very useful when it comes for developing android applications as It has intelligent code editor, fast and feature-rich emulator, It provides code templates and sample applications which are useful […]

CPU Usage Monitoring using Android Profiler
The Android Profiler is nothing but a replacement for Android Monitor tools in Android Studio 3.0 and higher. Android Profiler tools get real-time app data which helps to understand how your app uses CPU, memory, network, and battery resources. How to enable Android Profiler Enable inbuild profiler in android studioView > Tool Windows > Profiler […]

Disable MAC Randomization in Android 10 and above devices
Recently we came across an interesting feature, to set static MAC address for the wifi ssids for Android 10 and above devices.MAC Randomization generates a random MAC address for a wifi ssid for the following conditions mentioned below :- When connecting with that particular network for the first time=- Forget and rejoin the network. in […]

Set up work profile on company owned android 11 and above device
Android 11 introduces work profiles for company owned devices with improved support for work profiles. If a work profile is created from a setup wizard using QR code or zero touch enrollment, the device is recognized as Work profile on company owned devices. If a work profile is created using any other method except the […]

How to get Configured Network types from the Network Type Bitmask (Bearer)
OVERVIEW : Please refer to the overview section in https://techblogs.42gears.com/how-to-get-configured-apn-types-from-the-apn-type-bitmask/ to get an overview of Access Point Name (APN). While developing an application where we can configure an APN, view and edit the configured APN, one of the places where I was stuck was how to get the configured Bearer (Network types) so that the […]

How to hard reset Android devices and select the appropriate option in different Languages
Hard reset on a device is very challenging due to various reasons like different languages (Chinese, Spanish ..etc). This blog focuses on the steps to Hard reset the device and to identify the exact option to select in the recovery screen. Steps to hard reset devices with English option: Power off the device by long-pressing […]

Inject JavaScript to Android WebView
The problem statement is when we want to load specific JavaScript on the loaded webpage within WebView in any Android Application. There are two ways to achieve the results : 1. By using loadUrl() -> API level 18 and below With loadUrl(), the UI will be refreshed when the script is applied and it doesn’t […]

Getting Notification related to our application using microphone even though microphone permission is not declared in application’s Manifest file (Android).
Recently, we found an interesting bug while working with one of our partners. The issue was that even though our application and the libraries needed for our application were not using the microphone permission,still we were getting notifications related to our application using the microphone.The issue was easily reproducible on their set of devices as […]

Replacement of Deprecated AsyncTask in Android
AsyncTask is used to perform time talking operations in android, but it’s marked as deprecated from android 11. There are many alternatives are available for replacing an AsyncTask, one of the replacements is ExecutorService. AsyncTask Code: Above code snippet is general example of AsyncTask, for replace deprecated Async class, first create one Generic Class which […]

Battery Historian Setup
Overview Users don’t want an app that uses a lot of their energy life because their mobile devices have limited battery life. As a result, testers must keep an eye on the app’s battery use. A variety of native tools are available to test energy use, including Battery Historian, which displays battery consumption details for […]

How Can Enums Affect Android App Performance
What Is an Enum? A variable can be an enum type, which is a specific data type that allows it to be a set of specified constants. Enums in Java can be thought of as classes with a set of constants. The Java enum constants are inherently static and final. We utilise enums to define […]

Study the device power consumption with Battery Historian
The Battery Historian feature shows how a device’s battery consumption has changed over time. The programme visualizes power-related events from the system logs in an HTML representation at the system level. The tool gives a number of metrics at the app level that might help you discover battery-draining app activity. Battery Historian may be used […]
Dependency injection using Dagger 2
In a project with multiple classes, if a class (Class X) is dependent on another class (Class Y), then Class Y is a dependency on Class X. To access Class Y in Class X, it would be required to instantiate Class Y. This makes the code tightly coupled and difficult to test. To avoid these […]

Optimize Vector Drawable Path
To fix a Very long vector path we have some amazing tools like avocado and svgomg. It will optimize your vector drawable XML files.

Different ways of Analyzing ANR in Android
Using Bug Report: Reproduce the ANR and Capture the Bug report via Take bug report option from Developer options or via adb bugreport command. Search for Reason for ANR or am_anr in the Bug report to find which component it’s pointing to.Analyse the logs just 5 seconds or 10 seconds before this based on the […]

Handling Android 12 Splash Screen in existing projects
Google introduced a new Splash Screen behavior in Android 12 and it will automatically generate a splash screen on the launch of any application. This is causing an issue of showing two splash screens for some applications where a splash screen is already implemented. One will be the system generated one and the other will […]

Useful Shortcut to Speed up Android Development
Developing Android Application as an Android Developer requires a lot of things out of which writing code & navigating through code is an important aspect . So while doing that you can use a bunch of shorthand tricks that will help you speed up your development process. 1. Recent File List : Ctrl + E (in Windows) […]

Discover,enable and disable Bluetooth in Android programmatically
Before learning how to discover and enable Bluetooth in Android let’s know a few things about Bluetooth. Android Platform includes Bluetooth framework support that allows the device to wirelessly exchange data with other Bluetooth devices Android provides the Bluetooth API to perform these various functions. Scan other Bluetooth devices Fetch a list of paired devices […]

WebKit Provider Changes in Various Android Versions.
To understand webview implementation changes throughout the android versions, we first need to understand what Webview Implementation is : Webview Implementation is functionality that is available in Android OS developer options in the Android 7 and above devices. Using Webview Implementation, users can change which application to be used to provide a WebKit provider to […]

Common Things To Consider When Downloading Files in Custom Browsers Application For Android
More often than not when developing a custom browser in android, we face many hurdles at the time of downloading the files. On this blog we will look into 2 major things that Developers need to consider while developing their browser app. Adding Cookies to Android’s DownloadManager requests. When downloading a file from a website […]

Managed App Configuration For Android
Managed app configuration is a feature that gives IT admins the flexibility to remotely configure for work apps for different android users. previously known as application restrictions. App Restriction Manager : Application can define a logic which can be controlled by the App restriction Updates by it admins. RestrictionsManager Controls the Scheme and structure for […]

How to use Deeplinks in Android
Deep links are links that take users straight to an app rather than a website. Deeplinks in android saves time, increases the user experience.

Get Started With MVVM+DataBinding with Kotlin in Android
MVVM s a popular approach in the modern software industry because it helps to write business and UI logic in different modules.

List of all widely used ADB commands
Android Debug Bridge (adb) commands are very useful while debugging any Android device but at the same time it’s difficult to find all the commands at one place. In this article, you will find 200+ ADB, shell and fastboot commands which are commonly used for debugging Android devices. Using these commands can reduce the required […]

Generate Bug Report on Android Devices
A bug or issue in software can cause the system to fail or behave in an unintended way. It is very important for an app developer to identify and fix these bugs early in the software development life cycle. In order to troubleshoot the bug, the app developer needs a bug report from the Android […]
