Last Updated: January 11, 2017

Description:

In this post I'm gonna describe very helpful platform for building some stuff that involves 'Internet of thing'/ Internet of apis.

So lets get started.

Octoblu - It's an platform to build an amazing iot/iota projects that involve connection of 'things' with variety of tools involved in it. The 'things' could be sensors/led lights/apis from social networks like G+ or twitter etc.

1. Grant all permissions at once in Marshmallow and above.

As we know marshmallow compatible apps require permissions. So we normally show permission dialog to the user asking to grant us. That's fine. But every time clicking that 'allow' feels annoying for developers.

So the idea is to allow all the permissions at once without every time clicking the allow button.

Note: Disconnect phone and explore the app for few minutes and connect again

Step 2: Capture 'batterystats' using below command

adb shell dumpsys batterystats > batterystats.txt

Note: The command creates a file name 'batterystats.txt' into the current directory

Step 3: Clone or download the Github repo of 'Battery Historian' from Here. You will find a python script at path '../battery-historian/scripts/historian.py'Note: You can keep both 'historian.py' and 'batterystats.txt' in the same folder for ease

Step 4: Finally let execute the python script against our 'batterstats.txt' as input as show below

python historian.py batterystats.txt > batterystats.html

This will create 'battertstats.html' fig.1 which we can use to analyse the battery usage as shown HERE.

Last Updated: July 30, 2016

Description: In this post I'm gonna illustrate concept of 'Data Binding' in android. So straight away.

Let's get started.

'DataBinding' in android was introduced as an effort to coupled the model i.e data directly into the view, thereby eliminating findViewById() at much larger extend. Although its not limited to this and can help to remove lots of boilerplate code thereby. Its the direct roadway to implement MVVM pattern in our apps.

Step 2: Click on "ReTrace" fig.5. and upload your "mapping.txt" file from app/build/outputs/mapping/.../mapping.txt and the obfuscated code file (e.g: crash.txt). You can also simply paste the stackstrace in the box provided.

Note: If you do not find mapping.txt. You have to generate a signed apk with proguard enabled("minifyenabled true" within the app's build.gralde).

Note: You can download bg.png from here and icon.png from here and place in the folder created in step 1:

Step 3: The most important step is how to add our code in chrome browser. Open chrome settings from hamburger icon on the right of browser.
Settings --> extensions --> load unpacked extension(select your folder created instep 1) --> fig.1

Finally you'll see the your extension add to the chrome as shown in fig.2.

fig.2

If you find some issue implementing simply download and follow step 3.

To upload on chrome web store go here since we have developed this into developer mode.

Last Updated: February 09, 2016

Description: In this post I'm gonna demonstrate and show you some tips and tricks which really gonna help to solve some common problems while app development & help increase the speed as well.

So lets get started :-)

1. How to run app on phone without USB cord.(need USB initially to make connection)

Step 1: Connect the device with cord into your system. Ensure that USB debugging is enabled from Developer options. Open cmd(windows) or Terminal(linux) run the command. You'll find the connected device.

adb kill-server && adb devices

Step 2: Run the next command to restart in tcp mode on port 5555

adb tcpip 5555

Step 3: Now disconnect your device from system and note down your ip address of the phone from Setting > About Phone > Status. It could be something like 192.168.0.3.(ip address) Now the run the final command by replacing with your ip address

adb connect 192.168.0.3:5555

Bingo we're done now your devices is connected and you can run it wirelessly :-)

2. How to find SHA1 key from android studio?

SHA1 key is needed in many different app containing maps or social sites authentication or using any google apis and services.Its super usefull. So the simplest way to get that is using android studio.

Step 1: Select the Gradle projects from the right pane and expand Tasks > android > signingReport. (fig.1).Note: If you do not find your project in Gradle projects sync the project from android studio.

fig.1

Thats it you'll see the SHA1 for our project all the listed at once. Really awesome.

3. Best way to create icons for android app using vector asset.

Many a times in our development we need icons for small things with varied color or shape. Using Vector Asset in android studio we can create
our icons with super ease.

Step 1: Right click on app > New > Vector Assetyou'll see fig.3. You can choose Material Icons which contains whole lot of icons in different categories.This will create <vector> for the icon you have selected. (fig.4) in drawable folder

fig.3

Vector Asset for the icon

fig.4

Step 2: Awesome now just we can simply set to background or src of ImageView and other widgets.
.Thus just applying some simple tricks and tips really make a difference in the speed of development.

Last Updated: October 21, 2015

Description: In this post I'm gonna show you how to use android's support library v7 palette for extracting color from bitmap. Its can have variety of use-cases like making the background of the profile image somewhat similar to profile image or changing the whole UI as per the bitmap into the screen. Really Awesome !!!