Category Archives: Android

Get a million app downloads!

How to Get a Million Downloads

Do you want to get a million downloads? I discussed how to do just that at a MoDev event a few years back. In just 6 easy steps, you’ll be able to boost those app downloads. Now don’t worry because this isn’t an infomercial and I’m not selling anything. It’s just totally free advice with no strings attached.

There was a small group of people at this event (maybe 40), but the video has had over 15,000 views. I just watched it today (3 years later) and found that the concepts and methods still hold up. If you didn’t get discouraged from my last post, Ideas are Worth Nothing, then you have to watch my presentation when you are about to launch your new app.

Never stop learning!

Play the sound already

I spent all day figuring out how to play a mp3 file in my Android app.  Before you start to question my programming skills (which is fine) let me add a few requirements:

1. The sound file is contained in a subdirectory within my assets

2. The code should work for external assets outside of the bundle as well as assets within the bundle.  For this reason I didn’t want to use resource ids.

3. The file should be streamed and not loaded entirely into memory.

The MediaPlayer seems like the best option to use and I immediately tried coding to that.  I spent most of the time trying to get the Uri implementation to work (ex: “file:///android_asset/sounds/music.mp3”) but that just refused to work for me.

I was able to use the AssetManager to get a AssetFileDescriptor which can give you a FileDescriptor that can be used as a data source for the MediaPlayer.

Here is the code:

// get the asset file descriptor from our context
AssetFileDescriptor afd = mContext.getAssets().openFd(filename);

// media player created in idle state (always call setDataSource next)
MediaPlayer mp = new MediaPlayer();

// setting data source puts media player into the initialized state
mp.setDataSource(afd.getFileDescriptor(), 
                 afd.getStartOffset(), 
                 afd.getLength());

// setting of looping should be done in the initialized or 
// prepared state (not idle state)
mp.setLooping(false);

// prepare required before calling start or stop methods
mp.prepare();

// listeners require running on the ui thread
mp.setOnCompletionListener(new OnCompletionListener()
{
    public void onCompletion(MediaPlayer mp)
    {
        mp.release();
    }
});

// finally play it
mp.start();

// cleanup afd
afd.close();

Google wants to put your House in the Cloud

House in the CloudDo you ever want to live in a world in which your coffee maker preferences persist in the cloud so you can wake up anywhere in the world and enjoy your favorite cup of java? At one time I thought the company that would bring it to me was AT&T, but today I found out it was Google. (That reference is from 1993 TV commercials with AT&T and Tom Selleck, as shown below)

The Google IO keynote speech given today showed us where Google wants to take the Android platform. And that is… everywhere.

We already knew that they wanted it to run your smartphone, tablet, and television. But now they want to control your house and all your appliances. Home automation has been around forever and I’ve been using smarthome devices for years now. I only use it to turn off lights when I’m about to go to sleep. I know I can do a lot more than that but that is what I’ve found it most convenient to control–I’m tired and the lights need to be turned off.

Google gave me the impression that they weren’t just thinking about lights, although their demonstration did focus on light bulbs that you just screw in that could be controlled easily. What I found interesting is they demoed an exercise machine that connects to your phone and provides an interactive game to help you exercise. The game was pretty boring, but it illustrates something more important. They want your Android phone to be command central for everything. I can’t argue with that as I’m a big fan of simplification. I currently have 3 things that are always in my pocket–Car keys, wallet, and phone. If I could own a smartphone that can control all my devices, pay for anything, and even start my car then my life just got simpler. One device to control them all.

I reported the awesomeness of Arduino in a previous post and when Google announced their open accessory development kit that integrates with Arduino, I could only think of one thing–Brilliant. You can use your Android device to control anything and everything. And if you wanted to control something that wasn’t supported by the device, then then you could just build it yourself. The fact that they are using Arduino means that building hardware would be inexpensive. In addition to that, Arduino has a thriving open source community which could potentially build controllers for everything. This might just turn into an App Store of hardware accessories. Allowing developers build on top of a platform without having to pay licensing fees only means the platform could really grow fast. It will be a platform that people will want to have.

I think we can all agree that Google is great at pushing technology forward and worrying about the consequences later. I really like everything I heard today, and only hope that their Do No Evil motto doesn’t one day turn into Dr. Evil. I really don’t want an evil corporation taking control of my coffee maker.

Verizon to announce iPhone at CES?

Verizon iPhoneVerizon has never given a keynote speech at CES but will be doing so in a couple days. What’s the big news? Last year, they announced their LTE network for faster speeds and this year it is expected they will unveil new 4G phones that will use it. The rumor mill has been running at full force over what operating system the new phones will use–Android or iOS?

I will add to all the rumors and say one of my friends, who works for CES, has been telling me for months it will be the iPhone. But reports came out early this week that it will be a series of 4G Android phones.

All I know for sure is that I have not upgraded my 3GS iPhone because I want an iPhone4 on Verizon’s network. I think many people are in the same boat. January 6th will be an interesting day with the Mac App Store being released and the Verizon keynote. Buckle up.