Thursday, November 1, 2012

Organizing Resource Files

For very complex projects, I like to try to group the layout files together so that activity files, fragment 
files, adapter files and include files are all together. Developers working on an activity or fragment can immediately find the file that they need to change.  I do this by placing a key at the front of a file. Doesn't matter what the key is just as long as it makes sense. I typically make the activity files "views" and prepend a vi_ to their file names.Why? Eclipse will display the files alphabetically and since they files are not modified frequently, I want them at the bottom of the list and out of the way. Same goes for adapter template files.  

Here's what I use:

1, Container/Activity Files
Name container files the same as activity where possible. In this case I’ve named them vi_{ACTIVITYNAME}_container_portrait.xml and vi_{ACTIVITYNAME}_container.xml (for horizontal mode) I named them vi_* so that they end up towards the bottom of the directory since we won’t be touching them much and they’re more out of the way then.

2.       Fragments
In the example above, I named the fragment xmls, {activityname}.xml but we might want to call them fr_{ACTIVITYNAME}_top.xml, fr_{ACTIVITYNAME}_bottom.xml etc

3.       Include files for things like common headers I call inc_{FILEPURPOSE}.xml for example inc_topnav.xml

4.       Adapter list item files (I don’t see any in the screen shot) I would call li_{purpose}.xml  Purpose is generally related to the adapter name. For example, an adapter that shows a list of products would be called ProductsAdapter.java  with the list item being li_productsadapter.xml

Wednesday, August 15, 2012

Android Market Share now a dominating 68%

IDC reports that Android market share of the smart phone market has increased to 68%. Nearly 105 million Android phones shipped in last quarter, twice as many as a year ago. Apple also grew their shipments to 26 million.  Take a stab at Apple's market share.Where do you think it is? Way down at 17% of the global market.  Open platform is certainly the way to go.  Apple should have learned that way back in 1980s when it lost it's enormous advantage in personal computers to IBM compatible.

Sunday, August 12, 2012

Android: Business models Some Analysis of Downloads

A potential client contacted me the other day to talk about an idea that they have. It's a great idea and wanted to bounce around some business model ideas.  The question that they had was the following:

So, we are trying to figure out for Super App Idea, the kind of download traffic we might get if we were free vs $1 vs $2?  Do you have a feel for that?  I am sure it might be a little different on iPhone as opposed to Android as well.  Do you have any sense of conversion rates  as well?  

I did a quick look for a few apps that had a free version and a paid version. I decided to use a pill tracking system since that was an app I downloaded to test the other day.  The first app was a free pill box app (https://play.google.com/store/apps/details?id=com.mobilepills.pillbox&hl=en) that received between 10,000 and 50,000 downloads.  The first comment was put in on September 2010 so it's been around about 2 years. We'll assume that the first comment was put in right around launch date. So conservatively it is generating about 5000 downloads a year.  Note these downloads don't include downloads from third party distributors like Amazon. At a high end, they've received 25,000 downloads per year

The second one I looked at was a pay to use app that has similar functionality.   This app (https://play.google.com/store/apps/details?id=com.sartuga.android.pillboxalert) received between 1000 and 5000 downloads since their first comment on November 8, 2009. They are selling their app at $1.99. So taking the conservative 1000 downloads, that means that they've received about 300 downloads a year or revenue of about $600 per year. At a high end, they've received 1600 downloads per year or revenue of about $3200 per year.

Based on this example, free apps will get about ten times the downloads as paid apps.

I'm going to create a few more blog entries in the near future taking a look at a couple of ways to potentially increase the downloads if you have a paid application.

Monday, August 6, 2012

Determining where your Android APK is installed

A little bit of code can tell you where your apk files are being installed. Typically it will be /data/app/package.name.apk



07-25 09:15:59.065: D/Main(3000): Source directory at: /data/app/com.appulearn.supersecretapp.android-1.apk

This bit of code will tell you....


  PackageManager  pmMgr = getPackageManager();
        List pkgList = pmMgr.getInstalledPackages(PackageManager.GET_ACTIVITIES);
        List appinfo_list = pmMgr.getInstalledApplications(0);
        for (int x=0; x < pkgList.size(); x++){    
          Log.d(TAG, "Source directory at: " +appinfo_list.get(x).sourceDir);
        }

Friday, August 3, 2012

Designing Android Databases

Most of my app use a sqlite database and I use data scripts to create, alter and bootstrap tables. ADB comes with the ability to look at the database on a USB connected device, but I often test the scripts in an opensource tool called SqliteBrowser.  Unfortunately it's a little bit unstable, and seems like development on it has stopped but it's great for testing sql statements that you want to run within an Android app/

http://sqlitebrowser.sourceforge.net/

Tuesday, July 31, 2012

Android: Disabling or Blocking the back button

One of the tablet apps I've been working on is a massive data collection app. It is set up to run in vertical mode and it's easy for the user to accidentally push the back button and exit a data collection form potentially losing their work.  Luckily it is also easy to disable the back button by preventing the click action or putting a dialog up when it is touched to confirm the exit of the screen.

Here you go. Nothing to it.

@Override
public void onBackPressed() {
}

Thursday, July 26, 2012

Android logcat disappears with multiple devices attached

I was recently working on an Android project testing on multiple devices attached via USB and rotating the testing between them. After a while, all trace stopped being displayed and wouldn't come back. I disconnected devices, reset the debugging perspective, restarted Eclipse, restarted the laptop but nothing worked.  I typically have more than one Android device plugged in and in the past two years have never had any problems.  The solution was to go into DBMS perspective and select the specific device in the upper left hand panel. For whatever reason, it wasn't automatically switching based on what was running.