Category Archives: Uncategorized

Pokemon Go Simple Things Matter

Hi folks it’s been sometime since I wrote something. Thought may be to to write something on Pokemon Go as there are lots happening in that Game.

After Gofest 2020 which I would say is a success and people are happy specially after encountered boosted shinies compared to the day one. Now in Quarantine I am trying to hatch 7 km(3.5km) to get my hands on a shiny Deino in the Gofest Ultra Unlock Dragon Week 😀
I hatch eggs on free incubators so I don’t expect much. But people who bought incubators and trying to hatch a Deino seems like a bit disappointed.

Ok leave the deino for now. I know Niantic from their early days since they launched Ingress. Its an amazing game and it encouraged team play. But at that time community and the company is starting to grow so there were not many events. We get introduce to new features like 2 times. Concept is small easy to understand. And the game is all about coordination and strategy. So its a community driven game and it becomes interesting based on how aggressive are the opponent’s strategies. So people are kind of satisfied and did not expect much. Only issues as always in a GPS based game will be spoofing.

But when it comes to Pokemon Go. Its based on a popular franchise. So obviously there is going to be a huge audience with lots of expectations. When the game is launched with many bugs and minimal features, it broke lots of records world wide and made people run all over the places. They also broke their servers due to the load. But they recovered to cater the whole world within 6 months is a good come back.

I sometimes think they introduce the features very quick that there are lots of bugs, still are not attended too and new features leads to new bugs. I have seen people still complaining and grabbing free passes for raid issues(I don’t have to mention the new remote raid drop out bug) where Niantic is so generous. This leads to people miss use this generocity too. But they also cant help it as they have to maintain a good relationship with the players too. For them to be strict they have to be fault free first.

Covid-19 or Corona as some of you say made Pokemon Go to rethink how people can play the game from home. This made them increase the spawn rate of incense(An item makes Pokemon spawn around you) and introduced remote raids. They also had their Annual event GoFest this year as GoFest 2020 Home Edition, where anyone can buy the ticket and play from where ever they are. It actually made possible to retain Pokemon Go players in the global pandemic and lockdown issues. We should appreciate the effort of the Pokemon Go and the Niantic Team for this as they must have also being working from home. People are happy about these event and the new features and the lockdown bonuses.

But I don’t know if Pokemon Go and Niantic has thought the after effect of the covid 19. Now people are got used to the increased spawn rates and the liberty of doing raid from their home(Shhhh…! No one anymore knows if someone has spoofed). They will definitely going to get a bit discouraged seeing a regular spawns, they will still use the remote passes and stay home. So what will happen to the go out and explore thingy the core concept of the Niantic Games???

Now, we are having back to back events, shinies introduced and features ( I am looking forward to the Mega Evolutions). The players are continuously given something to be excited every day. Don’t forget when you give them excitement everyday even the small things starts to disappoint them if it fails. Maybe we can take the Deino Egg Event or its called the Dragon Week(I personally thought its a Dratini Community Week :D)

Remote Raid Passes and Incubators means money for most of the people, so if you are trying to get the player’s money the players will also will have some expectations. When they get disappointed they rant all over the internet. Hard core Pokemon fans wont abandon the game but the new prospect players may stay away if they come across these rants.

So if I summarize what I was writing up to now is, Pokemon Go you are doing great, keeping us entertained, even in the pandemic, I really appreciate that. But you also have to look back at some of the aspects like existing bugs leading to miss use of your generosity and consistency on event(egg, weekly event) shiny rates to maintain the player expectations. And finally to keep in mind the post pandemic days and on how to re enable the Niantic’s core idea on “Go out and play” without being discouraged.

Attack from the ‘Like’ Farms – Social Media

Social media has become a sea of opportunity. Opportunity does not comes alone, it comes with competition.  Especially when all the information you want can be found in the internet, it’s not uncommon that you find a competitor, a site or a person who mimics you or your work.

But don’t worry ‘Early Bird catches the Worm’ so you are always going to have a chance of having the head start.

But keeping up the head start is never easy if you are not already a renowned brand or a social icon already. So that’s where marketing comes in, and then with the current era it is always the digital media marketing that stands out.

When it comes to social media, a post’s or a site’s , page’s success is judged based on the ‘Like’ and the ‘Followers’ counts it has. It’s will not be an overnight success for a new company, person or a brand to get a lot of likes and followers. It needs a dedicated social media plan to be executed with good contend for months, sometimes year.

But do you know there are sites where you can actually pay and buy ‘likes’ and ‘followers’? Yes you can, can give a boost to a post or your site.  But most of the times they are static, so if you post something the the static followers will not interact with your posts, so it will create a small suspicious look among your real followers or even the new people who sees the numbers. For example, you have bought 2 million followers but you only get 45 likes for a new post, sure it will create a suspicion. But you still can buy more likes for that new post if you like. So basically if you have money even a newcomer can have a visibility in the social media.

But wait….! Do you remember once upon a time when there is only a ‘Like’ button available in facebook, you guys asked for a ‘Dislike’ button??? And facebook actually has introduced something called ‘Reaction’ with an ‘Angry’ and ‘Sad’ reaction included in it? Here is where your competitor have a upper hand on you 😀
What if he decides to pay one of those ‘Likes for Money’ to add angry on your latest post?

This is a threat to both new and the existing or even a well established accounts. You can get an Angry or a 1 Star rating attack on your site, page or a post. So its always be careful  that you don’t trigger a fight with your  competitor.

Ok, so how can you fight this problem? There is something called Influencer marketing which is the best counter against this kind of attacks. That we will see in the next Post…!

Case Study Analysis on Album Beyoncé

I normally don’t post marketing stuff in this blog but thought of sharing as there are a lot of interesting things happened in the launch of this Album. This is kind of a background and a SWOT analysis on the Album based on a case study by Anita Elbers,Stacie Smith: Harvard Business School : August 28th 2014.


Beyonce is an Album by Beyonce launched in 2013 and became a hit. A lot of things happened behind a surprise launch. This case gives us a lot of information that we can use to analyse and study about the US music market.


Music industry in the U.S

In USA there used to be a time when people buy the whole Album as everything comes in a single tape or a Disk. So earlier days Music events TV shows to promote the whole Album. Beyonce explains this saying how she misses her old days and how she and her family used to watch the Michael Jackson Event in TV.

These days it’s all about singles, a song from an Album gets popular and people only buy that specific song, Thanks to the latest technology Advancement. Sites like iTunes and Spotify have made agreement with the Artists and Music industries to make sure that the audio is released from their sites and they will make sure that the songs reach maximum people. They do early access promotions and provide the facility of buying singles online and download. So people don’t bother to buy a whole album they only buy the ones that are trending.

By some estimate, the total music market in the United States, covering both live and recorded music sales, was worth $15 billion in 2013 Already the largest segment at close to 60% of revenues, live music revenues were expected to grow. As far as recorded music was concerned, revenues from physical sales had been declining steadily in recent years, and only accounted for 15% of total music revenues in 2013, with digital sales making up the remaining 25% (Reference 1).


You can see how the trend is changing from the above data provided. If you see the Physical album sales(Blue Arrow), it is declining with the year where the Digital Album sales(Red Arrow) increasing with the Year.


Beyonce as an artist, a manager and a brand

From here onwards we will be analysing the context of Beyonce using the SWOT analysis. This section explains about the talents and her potential Strengths she got as an Artist and a Manager.

Born in an upper middle class family, she had the luxury of learning dance in the age of 7. Its one of her dancing instructor who found her talent of singing. Her career as a real artist started with Dancing. Performing in talent show, joined into a dance group.

Her family also supported her well including fashion and style and a place to rehearse for events.

But she got professional coaching after she has signed up with Columbia Records in 1996. Destiny’s Child the debut album with many popular singles has brought up the fame to the Beyonce as well her group.

Then later beyonce came up with several studio albums coming out in the period between 2003 – 2013 and became very successful. B’Day is one of the special albums released on her birthday.

She debuted in Hollywood with a film called ‘Dream Girls’ which tells the story of R&B in the period of 1960 – 1970s. Not only singing she is a Stage performer too. She has performed in more than 350 stages by 2013 with more than 10 million fans. Her tours are described as a marathon where she has done more than 100 shows in 11 months in her 5th world tour.

Despite being a woman taking it as a challenge within the society that talk has the common view of there must be a man who is managing all the programs and her company, she actually sits in her offices and work when she does not have any recordings.

Her company Parkwood Entertainment is formed in 2008 and she became the CEO of it. She is always productive and have bigger dreams, all the employees in the ParkWood are encouraged to voice their opinion rather than blindly following the instructions.There is time she has worked 18 hours per day encouraging the employees in the company.

Leadership has to be observed differently in the case of Beyonce. She is a performing artist, performing and managing a company specially the deals and the marketing strategies is not a joke.

Along with her fame with the songs and the song industry the Brand name ‘Beyonce’ also started to Gain popularity. She was endorsing some brands like L’Oreal, Tommy Hilfiger and Giorgio. But then by 2013 she started having things specifically made in her name on some popular Brands, like a whole new series of Items in her names in popular shops. And one of the partnership she had with is Pepsi, where they had a Super Bowl commercial with her and bottles printed with her face. So the brand ‘Beyonce’ really has grown into a powerful lure.

Launching Strategy

An album release was planned and now 8 months passed the expected date and the Album is still not out, media was becoming nosey on what is happening in the newly rented house. Fans are starting to get impatient. was not able to finish it. But still Beyonce does not want to rush it.

Beyonce came up with 3 criterias for the release

  1. Launch all songs at once
  2. Avoid any leaks
  3. Make it a Visual album

Releasing an Album is that she wants to bring the taste/experience of the old style Album to be fans.

Avoiding leak is an important issue as there is already many incidents of many popular artist’s albums have leaked causing the albums to appear in the online stores even before the release. This is a Great Threat, this need a lot of trust and great management skill to avoid this.

Releasing all the songs with visuals, turned out to be an expensive decisions but, Beyonce was certain that she will not change her decisions as she has planned to create the experience that she was having when she wrote the song.

These are some rare motives from an artist, to care about giving the fans a traditional experience and the feel unlike the other artists who write a song and sell as singles rather than bothering to create an album.

But selling the songs as Album with visuals can be taken as weakness. The fact that she wanted her fans to have a full album experience than Singles. And all the songs with Visuals. She is wasting a lot of resources, time and money here.
This weakness again can be turned into Opportunity If she can sell the songs individually without Video she can earn more and she don’t have to waste a lot of money too. This in future can be thought back where she can turn it into strength.

After creating the main criteria, the first step is to find a secure and popular partner who can handle the world wide distribution of the song at the exact same time. And they decided to go with apple as one of their main goal is the security and the power to handle heavy load. Apple also was in charge of converting the itunes home page to spread the surprise after the launch.

Then to spread the news they have to find a media that can penetrate a large number of Music loving generation and they ended up with Facebook. Facebook is excited to help Beyonce. The plan is to spread the news from the facebook music page and a promoted post to all who uses fb. And it’s all done in the cost of facebook as they encourage the professional services from the celebrities to the fans. And Also based on their suggestion Phase 2 is to do an online session on Instagram, a Ask Beyonce Session to Answer fans of questions.

17 Songs selected out of the 70 Cuts she made and the launch date November 13th is postponed to December 13th which is the last possible date so that they can print the cover and disks for the Physical Album before all the shops close before the Christmas holidays. During the Christmas holidays, specially the last 2 weeks,  nothing comes into a store and all the manufacturing companies will be shut down.


Summary of SWOT Analysis(Reference 4)


The Strategies used and not Used(Reference 4)

Success of the Beyonce Album

“Beyoncé Uses Only Word Of Mouth To Market Surprise New Album”(Reference 2)

“The Decisions to release an unexpected album in an unexpected way paid off fans went into meltdown and Beyonce shifted 430 000 copies in one day, in America alone” (Reference 3)


Sale Statistics for the next 3 Weeks from the launch(Reference 4)

The Comparison of Beyonce’s all the Major Albums with her Beyonce Album(Reference 4)

The above Quotes and the statistics will explains the success of the Album Beyonce. If you see the 3 weeks sales, the Peak is on the launch day, it explains that the Surprise strategy has reached like a wildfire with the help of facebook ads and the itunes alone. And if you compared to the Album Sales Beyonce has reached a record sales. 617k Downloads in the 1st 3 Days and 1.2 Million Downloads in the 1st 3 Months.

Recommendations to Parkwood Entertainment
The strategy that that Beyonce wanted to experiment or the experience she wanted to provided to the fans really worked. In a way it has saved a lot of time wasted on the marketing and spendings on Marketing and it returned to be still a Big Success. But continuing on this strategy may not work in future as the fans now will be on lookout.

For the future I would recommend them to follow with the traditional way. There are a lot of things that can be avoided. Launching a single from the album early will give a feedback on how the rest of the songs of the albums can be created. Analysing the market on what the current trend is and what people really need will always give you a step ahead. In the Album Beyonce, she was kind of stressed out as she wanted to finish this Album somehow and with visuals with very less time could have caused them to make a lot of mistakes, luckily the album is liked by the fans. What would have happened if they did not do a proper analysis and the album launch is failed? It would have affected the trust and the good positive relationship that they had with Sony entertainment. So it’s Good in a while to take a risk and Give the fans once in a lifetime Treat, but also it is important to avoid mistakes to stay afloat in the market and to be a challenge to the other artists.

1. Beyonc’e: Anita Elbers,Stacie Smith: Harvard Business School : August 28th 2014

2.Zack O’malley Greenburg (17 Dec. 2013.). Breaking Down Beyonce’s Record-Breaking Album Launch. Forbes. Retrieved from

3.Robinson, Peter (1 Jan. 2014.). Beyoncé has reinvented how to release an album. Over to you, Adele. the Guardian. Retrieved from

4.Patrick Cines : Beyonce Case Study: Hitting Replay on Success :  May 1, 2016:

Coaching and Mentoring – Grow Model

Recently I went through a training on Coaching and Mentoring. Since then I never thought them as two different things. So thought of sharing the knowledge i got from it with you all here.

Both are typically 2 things, coaching is more like a guided tour towards the problem’s solution, while mentoring is shedding light and making aware of the problem and making the person figure out the solution to his own problems.

Coaching is more like, the Coach gets some part of the ownership of the process of a task in which he is coaching. For example, in the context of Software engineering, coaching is in which the coach may join in a pair programing session to help solve the problem or provide expert advice on where to look into or suggests an architecture to apply.

In the case of mentoring, the mentor more often does not involve in finding the solution for the problem arisen. He will help you to untangle a problem and to focus on the problem and helps you make your own decisions. For example in the context of software engineering, a mentor will ask a series of questions which will reduce the complexity of the exact problem you need to fix. And also he may refer you to look into similar module areas to find a solution yourself.

In the sense coaching kind of drains the coach’s time, and its not productive compared to the mentor ship. In mentor ship the mentor clears the confusion and gives the basic information on what can help which saves the mentor’s time which he can work on something else and the person who is being mentored will also gets encouraged to solve the problem based on the information provided, more of self learning which is productive.

Encouraging mentor ship over coaching, for knowledge sharing will result in productive towards the new employee and saves time for the mentor, and all results in business profit.

So some of you may be still confused or unclear of what I was talking about above. Mentors use a model called Grow Model for the purpose of mentoring, I’ll explain how we can use it to mentor and you may have a better idea of what is mentor ship afterwards.

Grow Model is basically a set of targets you achieve by asking a series of questions

G – Goal
R – Reality
O – Options
W – When and Where

Goal is where you figure out what exactly your problem is and whats your exact focus is on for example “Keeping the Meeting stick to the Agenda”

Reality is the module where you identify the facts that may make the Goal complex, but as long as you know what they are, its not recommended you spend much time on this section.
For example “Albert always comes late to the meeting and he always finds a way to deviate the meeting from the agenda”

Park is an unofficial element in the GROW Model which I would like to mention here, where you put things that are making your main goal complex in. May be in future you can take them and define a GROW model for each of them later.

Options is the module where you come up with the options on how to achieve your goals and select one of them to be executed. For example “People who come late to the meetings are not allowed to join in, whenever the topic deviates, stop and bring it back to the point instantly”

Where and When is where you decide where and when the selected option will be executed and usually ends up with a follow up with the mentor on what happened.

So this GROW model does not has to be used only with mentoring, in the above scenario it is just another day to day meeting which I have applied. So feel free to try out this model and let me know how it worked.

RoundedImageView – Android


This is a library which consist of a RoundedImageView. This is a hassle free light weight ImageView that you can use for user profiles and other needs.

This can be integrated in your Android Studio project using this Gradle integration

compile 'com.pathofacoder.roundedimageview:roundedimageview:0.1.0'

Library can be found here –

This project is made Open Source under the Apache 2.0 license, so you can help improve the library by contributing here

A small sample will be added soon…

Pocket Signature View for Android

Android Signature View

This is a library which consist of a Signature View. This can be used as a Signature Pad
Main intention to develop this view is to avoid using bitmaps to use device memory efficiently.

-The drawn image can be out put as SVG(Vector Image), which is very much small in size. -Also the drawing data can be saved as String and that String can again be loaded in to this view.

This can be integrated inside your Android Studio using the Gradle

compile 'com.batzeesappstudio.pocketsignatureview:pocketsignatureview:0.1.6'

Library can be found here –

This project is made Open Source under the Apache 2.0 license, so you can help improve the library by contributing here

A small sample will be added soon…

New Permission Model in Android

Hi Folks, today we will be seeing the new permission model in action and how to handle it. You know that we define the system permissions that we need to run the app like Camera and “READ_EXTERNAL_STORAGE” and “WRITE_EXTERNAL_STORAGE” permissions in the manifest file. But this is not enough for the from the API level 23 , Android 6.0, the new model is introduced that is getting the permission from the user on the run time.

So we will see how we can do it. For this I am using the latest Build Tools 23.0.2
And the Compiled SDK Version is API 23

Always make sure you are using the latest build tools as Google always improve the backward compatibility through it.

Ok the the first thing you have to understand is, we will be checking this permission availability exactly before the place where we access the permission related operation. Adding this code will have no special effect on the phones that are running versions less than Android 6.0

And we have to add the regular permission as usual in the Manifest too. Else again the app will crash.

We will be doing a sample on getting a screen shot and saving it to the SD Card so here we need the “WRITE_EXTERNAL_STORAGE” permission

Step 1
At the place where we have to invoke the screenshot function we check if the permission is already available. If the permission is already available we proceed with the taking screen shot, else we call another methods which will invoke the  new permission request procedure.

if(PackageManager.PERMISSION_GRANTED== ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)){

Step 2
the method requestWritePermission(context) will check if the permission is already requested and if already requested and rejected it shows another Custom Dialog which explains why the permission is needed and when the Allow button is click it shows the Permission request again. Meanwhile if this is the first time the request permission procedure will automatically fired.
While we invoke the ‘ActivityCompat.requestPermissions’ method we pass a request code, in our case it is “REQUEST_WRITE_EXTERNAL_STORAGE” so that we can track back the result on the onRequestPermissionResult() override method and respond to it appropriately.

private static void requestWritePermission(final Context context){
    if(ActivityCompat.shouldShowRequestPermissionRationale((Activity)context,Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
        new AlertDialog.Builder(context)
                .setMessage("This app needs permission to write data to the phone so that the Screenshot can be saved")
                .setPositiveButton("Allow", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_WRITE_EXTERNAL_STORAGE);

    }else {
        ActivityCompat.requestPermissions((Activity) context, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_WRITE_EXTERNAL_STORAGE);

Step 3
In the onRequestPermissionResult() we catch the reult from the permission dialog and decide whether to go for the screenshot procedure or not

public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    switch (requestCode) {

            if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            } else {
                super.onRequestPermissionsResult(requestCode, permissions, grantResults);

So here is the order in it work, these are taken from one of my other app, and its done for reading from the SD card
step1    Step 2   Step 3

So that’s it guys hope you guys understood and will implement in your own application
Sample app can be found at the GitHub gitHub-download-button

You can get more info from the official documentation here :

Lets Write Code for MyO Armband – Android

Myo Armband is kind of a Wearable technology which senses the electrical signals produced when the muscles move. It got EMG Sensor, Gyroscopes and Accelerometer(Check here for Exact Spec 11137159_10204486542423879_2960066497525238836_n

So today we will see how to write code to get data and do stuff accordingly from the MyO Armband from the electrical signals that it can sense.

When the MyO Band is launched first, there was no instructions on how to setup the environment for the Android Studio. So there is a sample for Eclipse in Git Hub you guys can try it

But today we are going to create and run an app that responds to all your gestures in Android Studio

Ok then will jump into the Tutorial

Step 1
First of all you have to Download the MyO SDK from the site and Extract the zip file and place it somewhere so that later you can add the path of it. You may have to register yourself before you can download it.
(You can download the SDK here)

Step 2
Create a new Project in the Android Studio, at the time of this tutorial my Compile SDK Version is API 23 Android 6.0 (Marshmallows), Build Tool version is 23.0.2, Minimum target SDK is 18. Ill be using a Galaxy s3 for testing. When it comes to Android Marshmallows you have to handle the new permission system. I’ll be explaining it in another Blog.

Step 3
Go to the build.gradle(Module:app) and add these code snippet to the dependencies

repositories {
    maven {
        url 'C:\\Users\\adh\\Desktop\\myo-android-sdk-0.10.0\\myo-android-sdk-0.10.0\\myorepository'
compile 'com.thalmic:myosdk:0.10.+@aar'

Be careful when adding the maven url, it has to be the path to the MyO SDK, which you have downloaded earlier. And the path should go upto the level of the folder “myorepository”. In my case it was in the Desktop.

The compile line will get the library from the path provided above and sync it. The reason is unlike many other libraries the MYO is not hosted anywhere to automatically Android Studio to find it. So this is kind of a work around to build a MYO app in Android Studio.

Step 4
Next thing is in the SDK you have downloaded go to the
Eclipse –> MyoSdk–>libs and copy all the folders in it.
Be careful not to copy the “myosdk.jar”

Then go to the file location of your Android Studio Project
In the app–>src–>main create a folder called “jniLibs” and paste the folders you have copied earlier from the MYO SDK folder

Now your Project structure will look like this

Step 5
Ok now we have done the important stuffs and the workaround to some errors we may have faced(Actually I faced those errors and found out these workarounds, all happened due to no support for the Android studio from the MYO guys )

So we go to our main activity and first we have to create a instance of Hub and initiate it. Hub is the main guy who will be listening to the signals from the Band.

So we create and initialize it in the onCreate() method

Hub hub = Hub.getInstance();
if (!hub.init(this)) {
    Log.e(TAG, "Could not initialize the Hub.");

Step 6
Now we have initialized the Hub, now we have to find available MyO bands and connect to it. For that we start an activity called ScanActivity, which comes with the MyO SDK.

Intent intent = new Intent(context, ScanActivity.class);

All the hard work is done by the library, you will just have to select the device shown by this activity to connect your app with

Step 7
Ok now we come to a place where we have to set something called lock policy, as this is a Gadget which will be always moving here and there we have to enable one of the 2 policies available(You can create your own policy and apply them but for now we will see the 2 default ones)
One is LockingPolicy.NONE –  this one will remove any lock policies that are available, for this example I am using this for easy to understand
and the other one is  LockingPolicy.STANDARD – This policy is a general one that is used by most of the developers, which lock the device when it detects that it is not being used, so that when you want to use it again, you have to do the unlock gesture to unlock it.

So we have to apply a Locking Policy to out app too
So the next code snippet to add will be


Remember all the code I am adding are in the onCreate() mthod. And I am only showing the snippets here. In the Full Code sample you will find them nicely organized in to methods.

Step 8
The last code snippet in the onCreate is not important, but I thought its important to mention it. The MYO guys are actually getting some usage data through their API, but we can manually stop it by adding this code line

if (Hub.getInstance().isSendingUsageData()) {

I am checking if the usage data is being sent and if it returns true I am stoping it by passing the parameter ‘false’ to the method setSendUsageData()

Step 9
Now we have to create a method to create a listener and to respond based on the signals that we receive and Add it to the Hub

private void createAndAddListner() {

    mListener = new AbstractDeviceListener() {
        public void onConnect(Myo myo, long timestamp) {
            Toast.makeText(context, "Myo Connected!", Toast.LENGTH_SHORT).show();

        public void onDisconnect(Myo myo, long timestamp) {
            Toast.makeText(context, "Myo Disconnected!", Toast.LENGTH_SHORT).show();

        public void onPose(Myo myo, long timestamp, Pose pose) {
            switch (pose) {
                case REST:
                    Toast.makeText(context, "REST", Toast.LENGTH_SHORT).show();
                case FIST:
                    Toast.makeText(context, "FIST", Toast.LENGTH_SHORT).show();
                case WAVE_IN:
                    Toast.makeText(context, "WAVE_IN", Toast.LENGTH_SHORT).show();
                case WAVE_OUT:
                    Toast.makeText(context, "WAVE_OUT", Toast.LENGTH_SHORT).show();
                case FINGERS_SPREAD:
                    Toast.makeText(context, "FINGERS_SPREAD", Toast.LENGTH_SHORT).show();
                case DOUBLE_TAP:
                    Toast.makeText(context, "DOUBLE_TAP", Toast.LENGTH_SHORT).show();
                case UNKNOWN:
                    Toast.makeText(context, "UNKNOWN", Toast.LENGTH_SHORT).show();


Here the mListner is an instance of DeviceListener Class. And you can see 3 override methods it has, onConnect, onDisconnect and the onPose

If the device is connected properly onPose is the one that gets triggered when you try to do gestures  using the MyO Arm band. I have added different Toast Messages for each of the Actions. If the action does not match any of the predefined 6 Actions it will be fall under the Action “Unknown”

Step 10
So now that we have created the function to create the mListner and attach it to the Hub now we have to call it in the onResume()

protected void onResume() {

and must not forget to detach the listener when we go out of the app so on oPause function we remove the listener

protected void onPause() {

So that’s it folks now you can write your own code to do stuff for each of the MYO Arm Band’s gestures detected.

Have Fun Folks

For clear and clean code of this project visit the GitHub

Exploring Flic Button

What is a Flic?
Flic is a wireless hardware button. Works using Bluetooth, paired with your phone. It is not rechargeable but the battery is replaceable. Can be stuck on wall or pinned in dresses, for easy access depends on your need. It can broadcast 3 functions to your phone for 3 actions, Single Click, Double Click and Press and Hold.


It already has an app called flic, which got some basic day to day usable functions already defined. It is more than enough for your daily usage. But it got an API which we can use to invoke our own app or services that is running in the phone. This will enable us to develop a mobile solution which can be triggered using this button or create a service which can gather resources using the available sensors in the phone and send it to server. So we can consider this under Concept of IOT.

Ok so we will try to write something so we invoke our own functionality using the Flic Button.

Step 1
First of all this API does not work alone it needs you to install their android app and connect your Flic buttons using it. Before you start to concentrate on the API. You can download the app here

Step 2
Now you have to visit GitHub and download the Flic Library project. You can simply download it as a zip file and unzip it.  you can visit the site here

Step 3
Open the Android studio and create a new project that supports Minimum API level 19(Android 4.4), then go to File –> New –> Import Module and select the ‘fliclib-android’ from the git hub library project you have downloaded. Now you have added the library to the project structure.

Step 4
Now you have to add reference to the added library by going to  File -> Project -> Structure -> app (in the left sidebar) -> Dependencies tab -> The + button in the rightmost section -> Module dependency -> fliclib  and selecting ‘OK’

Step 5

on your main activity on the onCreate you have to set up the app credentials

FlicManager.setAppCredentials("[appId]", "[appSecret]", "[appName]");

You can get the credentials by registering your app at the Flic here

Step 6
Now after setting the App Credentials you have to grab a button from the main flic button app using this code snippet

try {
    FlicManager.getInstance(this, new FlicManagerInitializedCallback() {
        public void onInitialized(FlicManager manager) {
} catch (FlicAppNotInstalledException err) {
    Toast.makeText(this, "Flic App is not installed", Toast.LENGTH_SHORT).show();

So when you have selected the button on the onActivityResult call back you will get the results, and if the grab is success, you can registerBroadcast for specific functions, based on that the Broadcast receiver we are gona write in a moment, will trigger events. In this case we are subscribing the Broadcast Receiver for UP_OR_DOWN operation and REMOVED events only

public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    FlicManager.getInstance(this, new FlicManagerInitializedCallback() {
        public void onInitialized(FlicManager manager) {
            FlicButton button = manager.completeGrabButton(requestCode, resultCode, data);
            if (button != null) {
                button.registerListenForBroadcast(FlicBroadcastReceiverFlags.UP_OR_DOWN | FlicBroadcastReceiverFlags.REMOVED);
                Toast.makeText(MainActivity.this, "Grabbed a button", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(MainActivity.this, "Did not grab any button", Toast.LENGTH_SHORT).show();

So now we have configured the setting up we, have to write a BroadCastReceiver to get the calls from the button and trigger events

Step 7

Create a class called ‘BroadCastReceiverFlic’ that extends ‘FlicBroadcastReceiver’, which comes from the API project we added.
In that class in the Override method ‘onRequestAppCredentials’ you have to again setup the flic credential that you did at the main activity onCreate function.

Then as we have already registered for the UP_OR_DOWN and REMOVED broadcasts we can override these functions

public void onButtonRemoved(Context context, FlicButton button) {
    // Button was removed


public void onButtonUpOrDown(Context context, FlicButton button, boolean wasQueued, int timeDiff, boolean isUp, boolean isDown) {
    super.onButtonUpOrDown(context, button, wasQueued, timeDiff, isUp, isDown);
    if (isUp) {
        Log.d("IS UP", "True");
    } else {
        Log.d("IS DOWN", "True");

In the final method you can trigger events based on if the button is up or down(In my case I am Logging different messages). If you have subscribed for the Broadcast service “CLICK_OR_DOUBLE_CLICK_OR_HOLD” you could override the function ‘onButtonSingleOrDoubleClickOrHold()’

Any way for the sample code I’ll do the coding for ‘”CLICK_OR_DOUBLE_CLICK_OR_HOLD”‘ broadcast

So thats it folks you guys can get the full code here

Will Write our Own App to Trigger Mi Band

Xiaomi Mi Band is the world’s cheapest and branded fitness tracker. So why don’t we do some experiments so that we can make the Mi Band do what we say for a change?

I’ll be doing this code session for Android using Android Studio, hope others can understand the basics

Step 1
Firs of all we start a new empty project. And add 4 buttons. This is to test 4 basic functions of the Mi Band. Then initialize the buttons and ready the the setOnclick listners.

Step 2
Add Bluetooth Permissions in the Manifestfile, else you wont be able to connect to the band 😀

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /

Step 3
Add the Xiaomi Mi Band dependencyto the gradle and sync it

compile 'com.zhaoxiaodan.miband:miband-sdk:1.1.2'

Step 4

In the oncreate you have to create and initialize an instance of the MiBand Class

private MiBand miband;
miband = new MiBand(this);

Step 5

I have not done the pairing part in the code, but I assume the Mi band of yours is already paired to the device. If you have paired more than one device you can populate all the paired devices and allow the user to select one. But for the demonstration purpose I have only paired with my Mi Band so it is the one and only device returns to me

Object[] devices = BluetoothAdapter.getDefaultAdapter().getBondedDevices().toArray();
final BluetoothDevice device = (BluetoothDevice) devices[0];

So I am getting my paired device from the available devices, as I only got my Mi band paired I get the 0th device. hope you people got that part 😀

Step 6
No you have to connect to the paired device

miband.connect(device, new ActionCallback() {
    public void onSuccess(Object data) {
        Log.d(TAG, "Success !!!");
        miband.setDisconnectedListener(new NotifyListener() {
            public void onNotify(byte[] data) {
                Log.d(TAG, "Disconnected!!!");
    public void onFail(int errorCode, String msg) {
        Log.d(TAG, "connect fail, code:" + errorCode + ",mgs:" + msg);

Step 7

So if you have successfully connected to the device. You can start invoking functions of the MiBand in the button clicks
For example : You can make it Vibrate using this code snippet


You can check out some more commands in the sample code available in Git HubgitHub-download-button