Showing posts with label developer. Show all posts
Showing posts with label developer. Show all posts

Tuesday, August 17, 2010

Beyond Mobiles: Android as a Universal Development Platform

Early next year GoogleTV will include the Android Market, meaning that it will be a compatible device. A GoogleTV is unlikely to include telephony support, or a camera, microphone, vibration, compass, GPS, or LED. And it likely won’t be the first Android device that isn’t a phone.

This suggests that there are some changes in store for the Android compatibility definition.

If you were an apps developer when the first desktop computer was released – what would you have built?

25 year ago, when I was writing code in my parents living room, I held little expectation that anyone but me would ever use any of it. Sharing an app meant copying it onto a 5.25” floppy disk and biking it over to a friends house where, CRC errors permitting, we’d run it.

There was also the issue of OS fragmentation. I had an IBM compatible PC-XT, my school housed a collection of BBC Micros and most of my friends had Amigas and C64s.

Over the next decade “IBM compatible” became “PC” and the Internet provided an unprecedented distribution mechanism that lets your apps span the globe in a heartbeat.

Right now there are more than 60 different compatible Android devices

Until recently the only way to get your mobile apps onto a phone was through a relationship with a carrier or device maker. Today, every day, 200,000 more people are activating Android compatible devices and searching the Market for your apps.

The open nature of Android means hardware manufacturers are using Android to power an increasingly diverse range of connected devices. At the same time, the Android Compatibility Program is expanding to make more of these devices compatible.

People talk a lot about the dangers of fragmentation

Where some might complain, I see a unique opportunity. Suddenly we’re presented with a blank slate on which to innovate, a rare opportunity to consider new ways for people to interact with devices with which they are already familiar.

If you, as a developer, want to avoid dealing with fragmentation it’s easily done. Pick a single device and develop only for that (I’d suggest the Motorola Droid). You’ll miss out on an order of magnitude of users, but you won’t have to make your apps resolution independent.

The same code will do the same thing on any compatible hardware

The Android Compatibility Program eliminates the real risks of hardware fragmentation. As a developer, all you need to do is make sure that your software doesn’t make assumptions about the underlying hardware.

So what are the assumptions you need to avoid?
  • Screen size, resolution, and aspect ratio.
  • The existence of particular hardware.
Screen size, resolution, and aspect ratio

Android developers have been accounting for different screen sizes since Android 1.6 and the release of the Verizon Droid and HTC Tattoo. There is an excellent writeup describing how to support multiple screen resolutions on the Android Developer Guide, aptly titled Supporting Multiple Screen Sizes.

At the risk of providing spoilers, it will tell you to:
  • Use density independent pixels rather than hard-coding pixel values in your code.
  • Use layouts such as Relative Layout, that don’t assume screen sizes, aspect ratios, or resolutions.
  • Provide alternative layouts (if required) for small, normal, or large screens.
  • Provide alternative drawable assets for low, medium, or high resolution displays.
  • Use the emulator to test, test, and test.
The existence of particular hardware

When it comes to hardware dependencies, there are two questions you need to address. Does your app:
  • Need any specific hardware in order to function?
  • Use some hardware features if they’re available, but which aren’t strictly necessary?
Apps like Layar aren’t very useful on a device without a camera and compass. If the answer to question one is yes, you need to create a manifest entry declaring the hardware features your app requires. The Android Market will then filter those apps out for devices that don’t have the required hardware.

  <uses-feature android:name="android.hardware.sensor.compass"/>
  <uses-feature android:name="android.hardware.camera"/>


As I described in Future Proofing Your Apps, the Market will make some aggressive guesses even if you don’t specify all the hardware you require, so if the answer to question two is yes, you need to tell the Market.

Specify optional hardware when you will use it if it’s available, but your app doesn’t depend on it.

Google Places uses cool compass arrows to show the direction of a place on interest. Even without the compass the app would still be useful on my TV, so it should declare the compass hardware as optional.

  <uses-feature android:name="android.hardware.sensor.compass"
                android:required="false" />


Within your app you will still need to find the code that uses the optional hardware and modify its behaviour accordingly.In this example, I’d want the app to simply hide the compass arrow if the compass isn’t available.

You can determine the availability of any hardware feature using the Package Manager and modify the UI or behaviour of your app accordingly.

  PackageManager pm = getPackageManager();
  pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS);


To make your life easier, all compatible devices will maintain the APIs used to monitor and control all supported hardware, they simply won’t return useful results when the required hardware doesn’t exist.

Be a launch partner for future Android devices

As an Android Advocate I’m regularly asked by developers how they can have their app available as a launch partner for future devices. You can consider this blog post as my answer.

Monday, April 27, 2009

Android News

So it seems today is a day for Android announcements.

HTC has made the Android 1.5 (cupcake) system image available for the downloading and device flashing pleasure of ADP1 (developer phone) owners everywhere. This is an excellent opportunity to test your SDK 1.5 targeted applications on real hardware before it hits consumers, so get to it.

Speaking of consumers, O2 Germany just announced the June release of the first non-HTC device to hit the market, the Samsung I7500.

With more SDK features, more countries, more carriers, and more devices coming thick and fast, the potential audience for your kick-ass Android app is getting bigger by the second. Download the 1.5 preview SDK now and get started.

Monday, September 22, 2008

London Google Developer Day Android Wrapup

Tomorrow promises to be a big day for Android with most media outlets promising an announcement on the first Android handset.




Last Tuesday I was lucky enough to attend the Google Developer Day in London. As you might imagine, most of my interest this year was on the keynote and morning sessions on Android.






Mike Jennings, London's own Android Developer Advocate was on hand to give the first live European demo of the forthcoming Android-powered handset. From what we could see, the back handset looked pretty similar to the pictures posted around the internet and featured in earlier demos.

Mike's 'Blue Ball' demo indicates accellerometers will be included, and we were shown once again that GPS will be featured.

The user interface looks just like the one featured in the latest 0.9 Beta SDK, so no surprises there. As Mike ran through some of the demos the device seemed 'snappier' than the software emulators I've been using to test my sample applications, so that's a good sign.

Tech Talks

The Android tech talks on the day were introductory sessions targetted at people who new little or nothing about Android as a development platform. Both sessions were packed and through up some interesting questions -- not all of which had easy answers.

With the veil of secrecy still very much in place over all things Android a lot of questions went un-answered, but the following tidbits were covered

  • Application Installation. Users can install Android applications using any of the Micro SD card, USB cable, or Android Marketplace
  • Revenue Share. Google will pass on all revenue for applications directly to developers without taking a cut.
  • Carriers. When signing on, OHA member carriers agree to openness standards that prevent them artificially blocking the installation of any applications on user devices. The agreements let carriers modify the handset 'chrome' with their own branding, and select which applications to preinstall, but won't modify the software stack to restrict user choice after-market.
  • Push Email. Push email from a number of providers (not just GMail) will be supported.

More news tomorrow!