Friday 29 November 2013

Create a Fade In/Fade Out Effect With Fragments Within a View Pager

So I am working on my new app, and from the start I wanted it to have a combination of Pager Tabs Strips and View Pager in my app (the kind you see in Play Store app)

What else I thought will be cool is to have a fade in/fade out effect as the fragments in my app are scrolled within the View Pager. I have not seen this being implemented in any other app, so thought I'll explain how I did it.

First, familiarize yourself with what a View Pager is here.

1) Create an adaptor and assign it to your instance of View Pager:

MyAdapter mAdapter = new MyAdapter(getSupportFragmentManager());

final ViewPager mPager = (ViewPager) findViewById(R.id.pager);

mPager.setAdapter(mAdapter);

2) Create an On Page Change Listener for you View Pager instance:

mPager.setOnPageChangeListener(new OnPageChangeListener() {

      @Override  
       public void onPageSelected(int position) {}

      @Override
      public void onPageScrolled(int position, float offset, int arg2) {}

      @Override
       public void onPageScrollStateChanged(int state) {}
}

3) The idea is to reduce or increase the alpha value of each fragments parent layout as you scroll in and out of the fragments. I have three fragments, each with one parent layout:
Fragment 0: achievementLayout
Fragment 1: dbLayout
Fragment 2: adHocLayout

Before you can increase/reduce the alpha levels on these layouts, you need to retrieve your layouts in the onPageScrollStateChanged method. I found it best to get the current page being scrolled in this method itself, using the SCROLL_STATE_DRAGGING event. The page being scrolled is being stored in temp_page. 

@Override
public void onPageScrollStateChanged(int state) {
       //define layouts once
       dbLayout = (RelativeLayout) findViewById(R.id.dbLayout);
       adHocLayout = (RelativeLayout) findViewById(R.id.adHocLayout); 
       achievementLayout = (RelativeLayout) findViewById(R.id.achievementLayout);

       //once dragging starts capture the dragged page
       if(state == ViewPager.SCROLL_STATE_DRAGGING){
              temp_page = mPager.getCurrentItem();
       }
}

4) Now that we have the page being scrolled and the layouts, we can start the fade in fade out. This will happen in the onPageScrolled method. 

@Override
public void onPageScrolled(int position, float pos, int arg2) {
        switch (temp_page){
        
             //Fragment 0 scroll
             case 0:
                  achievementLayout.setAlpha(1-offset);
                  break;

             //Fragment 1 scroll
             case 1:
                   //swiping to higher
                   if(temp_offset<pos){
                           dbLayout.setAlpha(1-pos);
                           adHocLayout.setAlpha(pos);
                  }
                  //swiping to lower
                  else if(temp_offset>pos){
                          dbLayout.setAlpha(pos);
                          achievementLayout.setAlpha(1-pos);
                  }
                 temp_offset = pos;

                 break;

           //Fragment 2 scroll
           case 2:
                 adHocLayout.setAlpha(offset);
                 dbLayout.setAlpha(1-offset);
                 break;
      }
}

Offset value starts from 0 and goes up to 1 when a fragment is scrolled from left to right, and vice versa when scrolled from right to left. Hence alpha is set either directly or by doing a (1-offset). The tricky part here is how to determine if the fragment is being scrolled left to right or right to left in the case of the middle fragment (Fragment 1). To overcome this, I used a temporary variable temp_offset to capture the offset value and compare it to the next offset value, if temp_offset is lower than the next offset, then the fragment is being scrolled from right to left and vice versa. 

There are a few other minor tweaks which you can make to smoothen the scroll and the flickering. But if you've understood the above piece, that is child's play.

Hope this helps.

Till next time.

Wednesday 20 November 2013

Achieve Higher Ranks and Better Downloads for your Apps

Before I start rattling off, let me make it clear that I do not have millions of app downloads against my name, nor do I advocate not marketing your app. I am just stating my experience below.

I have launched 2 apps in the Google play store and I have managed to achieve a better ranking resulting in a higher number of downloads. My Fuel Buddy app used to be ranked 350+ in the Play Store, this has now come down to 120. My downloads have also significantly increased, I used to get about 30 - 40 downloads a day for Fuel Buddy. I managed to get these up to 100 - 150. Let me share on how I managed this. Mind you my experience is only in Android and hence these points, as far as I am concerned, are only valid for Google Play Store.

1) Pay Attention to your App Title

The most important thing which will get your app ranked higher is keeping an intelligent title. Whatever is the functionality of your app, try to include that in the title. Google allows 30 letters, try to squeeze in some important key words in the title itself. Eg, I changed my app title to Fuel Buddy (Gas, Mileage Log)

2) Give Frequent Updates

I have observed that there is always spike in downloads for about a day or two after your update. So make sure you churn out updates for your app. This does not mean giving an update everyday, but at least try to stick to 2 updates a month. These updates could be simple bug fixes as well.

3) Release your App in Multiple Languages

This is an obvious one. More languages means a wider audience. And Android makes it pretty easy to do this (as long as you have parked your strings in the strings.xml). I get my translators from Fiverr.com. Its a pretty decent site. With most gigs starting at $5. So usually end up paying $10 for a translation, 5 for the strings in my app and 5 for my App description in Play Store.

4) Strive for more Ratings

You can do this by displaying a pop-up asking the user to rate your app and then re-directing him to your app store page. I display a pop-up after my app has been opened 10 times. The good part is that if the user has been using my app for that long he likes it and more often than not ends up giving a good rating.

5) Get Feedback

Giving the user an option to provide feedback will reduce your chances of getting a poor review. In case a user is unhappy with a feature, he'd much rather reach out to the feedback button than leave a bad review (unless you've managed to really piss him off!!). There are multiple Feedback services which you can implement in your app and they let the user drop his feedback in your mailbox. You can even reply to that mail and the user will receive a response within the app. If you do not want to implement these in your app, make sure to place your email link which the user can easily access.

If you guys have better ideas to achieve higher downloads and improve rankings please do give a shout out.

Adios.

Sunday 17 November 2013

Designing Your Mobile App

So I have been working on my new app, all guns blazing. Which is actually not a very good thing to do. I was very close to completing the app when a few people pointed out some glaring design issues. Though I argued and tried to convince them that what is built is right, I soon realized my mistakes. Even tough I always knew that there was a big loop hole in the app, I went ahead with the design which backfired (luckily before the launch).

So now I am in the process of re-designing the app. And I am trying the be very careful with what I am doing. So here are a few pointers I have come up with which I would like to share with you. And hopefully you guys don't make the same mistake I made.


1) Make sure the core functionality of your app is air tight

By this I mean that you have identified, very very clearly, what your app is meant to do for the user. If your app is solving a problem for the user, what is the problem, and how are you going to solve it. Leave out the peripherals. Think about the first impression your customer will get when he downloads your app

2) Start with a birds eye view

Since we are so excited to develop our idea into an app, we get caught up in the nitty-gritty details of the app. What should my menu button look like, how should I construct my 'About' screen... 
Forget about these things when you are designing the first draft of your app. Zoom out to 1000ft and worry about what your app should look like from up there. Many a times during the initial design phase we start thinking about these trivial things. At that time, remember to zoom out.

3) Design the main screen first

In my case the main screen is the first screen the user will be seeing. This may not be true for all apps. Initially I coded my second screen first, which is the more heavy duty screen, and later had to somewhat accommodate the main screen. This was a huge mistake and cost me almost 2 weeks of my work. So please be very careful while deciding what your main screen is and make sure you design that before all others.

4) Keep it SIMPLE... really simple

We may like to put in a lot of bells and whistles in our apps, and it may appeal to the user as well when he reads the app description, but believe me if he even has a hint of confusion while operating the app for the first time, he will uninstall it without thinking twice. This is because the consumers are spoilt for choice with the millions of apps available. They will not be wasting their time trying to learn your app when they know there are ten others available in the app store.

I hope the few points mentioned above help you out. 

Till next time.

Adios

Friday 1 November 2013

October App Report

Alright guys, as promised publishing my App Download and Income report for the month of October. 

I launched quite a few minor updates for 'Fuel Buddy' and fortunately the audience responded well to those. The downloads are slightly better than September. Not where I want to be but satisfied for now. Once I get time I will be working on including some major features which the users have been requesting, such as sending email reports, adding an option for services,  reminders, etc. I also want to add some in-app purchase components in the app. Hopefully I can get working on those soon.

I have left the Pingy Pong untouched. So understandably the downloads are less than the last month.


October Download and Income report



Fuel Buddy



Downloads in October: 2564
Admob Revenue: $81.06
eCPM: $0.67
Requests:120,610






Pingy Pong



Downloads in October: 1663
Admob Revenue: $17.30
eCPM: $0.33
Requests: 55,357