Near Field Communication (NFC) is a set of short-range wireless technologies, typically requiring a distance of 4cm or less to initiate a connection. NFC allows you to share small payloads of data between an NFC tag and an Android-powered device, or between two Android-powered devices.
Happy Coding Discussion on Android Framework(Generic and MultiMedia), Java, JNI, C++ and Python related topic
Friday, 31 July 2020
Saturday, 27 June 2020
SCO and ACL in Bluetooth
Hi Guys !!! Hope all is well
I am going to discus Bluetooth ACL and SCO in Android.
Voice data in Bluetooth hands free kit is an example for this
This narrow band audio is called "Bluetooth voice" type
Where as ACL is for all other BT data transfer including High quality audio/video data
Example is music playback through A2DP. This is high bandwidth data and hence called "Advanced Audio"
SCO is fixed bandwidth channels and can have maximum 3 channels per device,
but throughput of ACL varies with other active connections(SCO and ACL) at that time
I am going to discus Bluetooth ACL and SCO in Android.
- ACL= Asynchronous Connection-Less
- SCO = Synchronous Connection Oriented.
- SCO is Point to Point Connection between only one master and only one slave
- ACL is multi-point connection between one master and many slaves
Voice data in Bluetooth hands free kit is an example for this
This narrow band audio is called "Bluetooth voice" type
Where as ACL is for all other BT data transfer including High quality audio/video data
Example is music playback through A2DP. This is high bandwidth data and hence called "Advanced Audio"
SCO is fixed bandwidth channels and can have maximum 3 channels per device,
but throughput of ACL varies with other active connections(SCO and ACL) at that time
Tuesday, 23 June 2020
Bluetooth Low Energy Scanning
Hi Guys !!! Hope all is well
In my previous post I have discussed BLE Advertisement. Now I am going to discus Bluetooth Low Energy (BLE) scanning in Android.
So below sample code detect ble advertising devices(ble beacons) and list it down there name MAC Address and RSSI value. You can download complete project from my GitHub page
In my previous post I have discussed BLE Advertisement. Now I am going to discus Bluetooth Low Energy (BLE) scanning in Android.
Recap from previous post
- Bluetooth Low Energy (BLE), available in Android 4.3 and later
- Creates short connections between devices to transfer bursts of data
- Bluetooth Low Energy (BLE) conserves power by remaining in sleep mode most of the time
- It wakes up only to make advertisements and short connections
In this tutorial, We will learn about the
BluetoothAdapter.LeScanCallback class,which enables developers to turn a supported phone into a Bluetooth LE scannerwithout the need for additional hardware. You can detect all near by BLE Beacons and communicate with them./*** Start the bluetooth low energy scan.
*/
private boolean startBleScan() {
boolean isSuccess = true;
// Scan filter for iBeacon.
ScanFilter.Builder builder = new ScanFilter.Builder();
builder.setManufacturerData(0x004c, new byte[] {});
SCAN_FILTER_LIST.add(builder.build());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mScanCallback = new ScanCallback() {
@Override
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void onScanResult(final int callbackType,final ScanResult result) {
// Print out the RSSI value from result
Log.d("saurabh_Tx", "onScanResult RSSI: "+ result.getRssi());
try {
// Print out the rssi value
runOnUiThread(new Runnable() {
@Override
public void run() {
mDeviceAdapter.update(result.getDevice(), result.getRssi(),result.getScanRecord());
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onScanFailed(final int errorCode) {
Log.d("saurabh_ScanFailed", "errorCode: "+ errorCode);
}
};
// There is no immediate value telling if scan is failed or not
if (null != mBTAdapter.getBluetoothLeScanner()) {
ScanSettings scanSettings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
scanSettings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
.setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES)
.setNumOfMatches(ScanSettings.MATCH_NUM_MAX_ADVERTISEMENT).build();
}
mBTAdapter.getBluetoothLeScanner().startScan(SCAN_FILTER_LIST, scanSettings, mScanCallback);
} else {
isSuccess = false;
}
} else if (Build.VERSION.SDK_INT>= Build.VERSION_CODES.JELLY_BEAN_MR2) {
// On some Android device, Bluetooth LE (Android Version < 4.1)
// scan is unstable. Turning off scan every 3 seconds as
// a workaround for this issue
mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device,final int rssi, final byte[] scanRecord) {
try {
// Print out the rssi value
Log.d("saurabh_Tx", "onScanResult RSSI: " + rssi);
runOnUiThread(new Runnable() {
@Override
public void run() {
mDeviceAdapter.update(device, rssi, scanRecord);
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
};
isSuccess = mBTAdapter.startLeScan(mLeScanCallback);
}
return isSuccess;
}
Thanks
Saurabh
Happy Coding !!!
Tuesday, 9 June 2020
Bluetooth Low Energy Advertising
Hi Guys !!! Hope all is well
Today I am going to discus Bluetooth Low Energy (BLE) in Android.
In this tutorial, We will learn about the BluetoothLeAdvertiser class,
which enables developers to turn a supported phone into a Bluetooth LE beacon
without the need for additional hardware.

Today I am going to discus Bluetooth Low Energy (BLE) in Android.
- Bluetooth Low Energy (BLE), available in Android 4.3 and later
- Creates short connections between devices to transfer bursts of data
- Bluetooth Low Energy (BLE) conserves power by remaining in sleep mode most of the time
- It wakes up only to make advertisements and short connections
In this tutorial, We will learn about the BluetoothLeAdvertiser class,
which enables developers to turn a supported phone into a Bluetooth LE beacon
without the need for additional hardware.

You can download complete project from my GitHub page
private void advertise() { mBluetoothAdvertiser = BluetoothAdapter.getDefaultAdapter().getBluetoothLeAdvertiser(); AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(mode) .setTxPowerLevel(power) .setTimeout(3*60*1000) .setConnectable(true) .build(); ParcelUuid pUuid = new ParcelUuid( UUID.fromString( getString( R.string.ble_uuid ) ) ); AdvertiseData data = new AdvertiseData.Builder() .setIncludeDeviceName( true ) //.addServiceUuid( pUuid )
.addServiceData( pUuid, "SK".getBytes(Charset.forName("UTF-8") ) ) .build(); advertisingCallback = new AdvertiseCallback() { @Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) { Log.e( "Saurabh_BLE", "Advertising onStartSuccess: getTxPowerLevel "
+ settingsInEffect.getTxPowerLevel() );
String modes = "";
if(2 == settingsInEffect.getMode()){
modes = "LOW LATENCY Mode";
}else if(1 == settingsInEffect.getMode()) {
modes = "BALANCED Mode";
}else if(0 == settingsInEffect.getMode()) {
modes = "LOW POWER Mode";
}
String power = "";
if(3 == settingsInEffect.getTxPowerLevel()){
power = "TX_POWER_HIGH";
}else if(2 == settingsInEffect.getTxPowerLevel()) {
power = "TX_POWER_MEDIUM";
}else if(1 == settingsInEffect.getTxPowerLevel()) {
power = "TX_POWER_LOW ";
} else if(0 == settingsInEffect.getTxPowerLevel()) {
power = "TX_POWER_ULTRA_LOW";
}
mText.setText("Advertising Start: Success \n"+
"Advertising PowerLevel: "+power+"\n"+
"Advertising Mode: "+modes+" \n"+
"Advertising Timeout(ms): "+settingsInEffect.getTimeout()+"\n"+
"Advertising Connectable: "+settingsInEffect.isConnectable());
super.onStartSuccess(settingsInEffect);
}
@Override
public void onStartFailure(int errorCode) { Log.e( "Saurabh_BLE", "Advertising onStartFailure: " + errorCode ); mText.setText("Advertising Start Failure ErrorCode: "+errorCode); super.onStartFailure(errorCode); } }; mBluetoothAdvertiser.startAdvertising( settings, data, advertisingCallback ); }
Thanks
Saurabh
Happy Coding !!!
Monday, 18 May 2020
Vysor alternative App : Scrcpy
Hi Guys !!! Hope all is well
Today I am going to discus best alternative app Scrcpy for Vysor.
As you guys know :- Vysor lets you view and control your Android on your computer. But It is not free or open source App. You can only use few feature in free edition App. For more detail :- https://www.vysor.io/
But As we love open source project and software for our day to day use. We need a best alternative app for Vysor. So Scrcpy is best alternative app. It is full loaded with feature and free. Not only free it is open source app. So we can download modify source code as per our requirement.
Today I am going to discus best alternative app Scrcpy for Vysor.
As you guys know :- Vysor lets you view and control your Android on your computer. But It is not free or open source App. You can only use few feature in free edition App. For more detail :- https://www.vysor.io/
But As we love open source project and software for our day to day use. We need a best alternative app for Vysor. So Scrcpy is best alternative app. It is full loaded with feature and free. Not only free it is open source app. So we can download modify source code as per our requirement.
scrcpy (v1.13)
This application provides display and control of Android devices connected on USB (or over TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and macOS.
This application provides display and control of Android devices connected on USB (or over TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and macOS.

It focuses on:
- lightness (native, displays only the device screen)
- performance (30~60fps)
- quality (1920×1080 or above)
- low latency (35~70ms)
- low startup time (~1 second to display the first image)
- non-intrusiveness (nothing is left installed on the device)
- The Android device requires at least API 21 (Android 5.0).
- Make sure you enabled adb debugging on your device(s).
Get the app
Linux
Ubuntu (20.04/18.04/16.04/14.04):
Just download the zip and unzip it. After unzipping Open that folder in command prompt(cmd) and run only scrcpy in command prompt. It will screen cast your connected device in your window machine . Enjoy it using without any tension.
apt install scrcpy
Windows
For Windows, for simplicity, a prebuilt archive with all the dependencies (including adb) is available: scrcpy-win64-v1.13.zip
Windows
For Windows, for simplicity, a prebuilt archive with all the dependencies (including adb) is available: scrcpy-win64-v1.13.zip
Note :- If it not detected your connected device in Window 10 then please check Environment path variable . It should be like this
C:\android_sdk\platform-tools\adb
Thanks
Saurabh
Happy Coding !!!
Monday, 11 May 2020
Best Code Editor : VS Code
Hi Guys !!! Hope all is well
Today I am going to discus best code editor "VS code". if you search on google top 5 best code editors for 2020 or 2019 or 2018, you can see VS code editor rankings in top 3.
VS Code
- VS code is a product of Microsoft and a cross-platform editor.
- Developers can use this powerful tool either on Windows, Linux, and mac.
- VS Code has powerful features that will fully support developers’ work.
- With the VS code, you are assured of fast system debugging and auto-completion
Key Features
- Cross-platform
- Built-in Git and git commands
- Reliable autocomplete and syntax highlighting using IntelliSense
- Debugging code right from the editor
- Easy to integrate with terminal
- Extensions for customizing and extending functionalities
- Ease of deploying projects to such platform as Microsoft Azure
- Compatible with almost every programming language
- Easy to use
- Lightweight and robust as compared to other editors
- Best part a lot of best plugin available and you can install and uninstall after use
The community support for the VS Code is incredibly passionate, and that works to everyone’s benefit. The VS Code being an open source, that community works exceptionally hard to keep VS Code competitive with the rest of the field. Written in Node.js and Electron, you can be sure the code isn’t going to become an outdated or lag behind any time soon. Their support is tremendous, and every month, they are releasing new features to keep up with the latest workflow.
Some Famous plugin
Try this code editor and find the real power of light weight, fast code editing, compiling and pack of powerful feature and plugin. I am sure it will suit your need.
Some screenshot of plugin I use in my machine
Some screenshot of plugin I use in my machine
Thanks
Saurabh
Happy Coding !!!
Saturday, 25 April 2020
Best Android libraries for App development
Hi Guys !!! Hope all is well. Current on going COVID-19 pandemic is really a big setback for everyone.
But hope for the best. We together overcome of it.
Today I am going to put top android library name and its uses detail for android app development help.
1. For Handling images in app
we can choose any one of the below library for image handling in our app as per need.
HTTP library that makes networking for Android apps easier and most importantly, faster is listed below. Top three library is Volley, okhttp and retrofit.
An HTTP inspector for Android that allows you to dig into your application’s HTTP history.
Room includes out of the box support for Rx and “LiveData,” so you can decide to use it however you like. The main benefit Room offers over other ORMs is its simplicity.
But hope for the best. We together overcome of it.
Today I am going to put top android library name and its uses detail for android app development help.
1. For Handling images in app
we can choose any one of the below library for image handling in our app as per need.
- Glide library, which loads and displays images as quickly and smoothly as possible.
- Other popular image loading libraries include Picasso from Square
- Coil from Instacart and
- Fresco from Facebook
HTTP library that makes networking for Android apps easier and most importantly, faster is listed below. Top three library is Volley, okhttp and retrofit.
- Volley
- OKHTTP (HTTP + HTTP /2)
- RETROFIT
- ION (KOUSH)
- ANDROIDASYNC (KOUSH)
An HTTP inspector for Android that allows you to dig into your application’s HTTP history.
- Android Studio Profiler (Network) — a native profiler of the Android Studio
- OkHttp Profiler — a plugin for the Android Studio/IntelliJ IDEA
- Facebook Stetho — a debug bridge for Android applications
- Charles — a proxy application for network
- AppSpector — a debugging tool for Android devices
- Chuck:- he HTTP log is displayed as a notification, which on expanding open full Chuck UI
- Timber is powerful, yet simple, logging library built on top of Android “Log” class
- HyperLog is a utility logger library for Android on top of standard Android Log class for debugging purpose
- Logger Simple, pretty and powerful logger for android
- Console An Android console view, which allows you to log text using static calls, to easily debug your application, whilst avoiding memory leaks
- Room
- OrmLite
- SugarORM
- Realm
Room includes out of the box support for Rx and “LiveData,” so you can decide to use it however you like. The main benefit Room offers over other ORMs is its simplicity.
6. Scanning
FancyToast-Android
This library makes native Android Toasts Fancy
Material Dialogs for Android
This is a library that implements animated, beautiful, and stylish material dialogs.
Cyanea
This is a theme engine for Android
IndicatorScrollView
This library adds logic to a NestedScrollView, allowing it to react dynamically with an indicator when the scroll is changed.
ProgressButton
This library provides a Button with a built-in progress bar inside. The idea is not new, but this is a fresh approach to it.
RubberPicker
This is an animated and interesting approach to SeekBars.
CircularProgressBar
This isn’t a new library, but it was refreshed in 2019. It helps you create a circular ProgressBar in the simplest possible way.
Croppy
This is yet another approach to image cropping for Android.
CalendarPicker
This library is another calendar and date picker. It can preset a selected date and is heavily customisable
CalendarView
This is a highly customizable calendar library, powered by RecyclerView.
- Zxing :- Barcode image-processing Android library that is implemented in Java support for the 1D product, 1D industrial, and 2D barcodes.
- ZBAR :- barcode/QR code scanner library is a very good lightweight alternative to ZXing library and very easy to use and lightweight too. The ZBAR library supports variety of bar code standards and also QR codes. My favourite library for scanning
- CAMView
- MPAndroidChart :- An impeccable Android chart/graph view library
- Holo Graph library :- A new graphic library which is continuously becoming a favorite of many
- AChartEngine
- AFreeChart
- AndroidCharts
- Androidplot
FancyToast-Android
This library makes native Android Toasts Fancy
Material Dialogs for Android
This is a library that implements animated, beautiful, and stylish material dialogs.
Cyanea
This is a theme engine for Android
IndicatorScrollView
This library adds logic to a NestedScrollView, allowing it to react dynamically with an indicator when the scroll is changed.
ProgressButton
This library provides a Button with a built-in progress bar inside. The idea is not new, but this is a fresh approach to it.
RubberPicker
This is an animated and interesting approach to SeekBars.
CircularProgressBar
This isn’t a new library, but it was refreshed in 2019. It helps you create a circular ProgressBar in the simplest possible way.
Croppy
This is yet another approach to image cropping for Android.
CalendarPicker
This library is another calendar and date picker. It can preset a selected date and is heavily customisable
CalendarView
This is a highly customizable calendar library, powered by RecyclerView.
Hope it helps.
Thanks
Saurabh
Happy Coding !!!
Subscribe to:
Posts (Atom)
Build a Custom Kernel Module for Android
Hi Guys!!!Hope you are doing well !!!. Today I will describe how you can write a custom kernel module(Hello world) for Android and load it a...
-
Hi Guys !!! Hope all is well Today I am going to discus best alternative app Scrcpy for Vysor. As you guys know :- Vysor lets you vie...
-
Hello Guys !! Hope you all doing well. Today I am going to discuss how to add android app as a system app. First question, What is system...
-
hello Guys!!! hope you all are doing well. Toady I am going to discuss about tombstone a native crash in Android framework. I am starting w...






