Pages

Ads 468x60px

Friday, December 18, 2009

Hello, Stack Overflow!

Over the past year, an Android presence has been growing on a relatively new technical Q&A web site called Stack Overflow. The site was designed specifically for programmers, with features like syntax highlighting, tagging, user reputation, and community editing. It's attracted a loyal software developer community, and developers continue to express great praise for this new tool. Well, the Android team has been listening...and we agree.

Today, I'm happy to announce that we're working with Stack Overflow to improve developer support, especially for developers new to Android. In essence, the Android tag on Stack Overflow will become an official Android app development Q&A medium. We encourage you to post your beginner-level technical questions there. It's also important to point out that we don't plan to change the android-developers group, so intermediate and expert users should still feel free to post there.

I think that this will be a great new resource for novice Android developers, and our team is really excited to participate in the growth of the Android developer community on Stack Overflow. I hope to see you all there!

Back and other hard keys: three stories

Android 2.0 introduces new behavior and support for handling hard keys such as BACK and MENU, including some special features to support the virtual hard keys that are appearing on recent devices such as Droid.

This article will give you three stories on these changes: from the most simple to the gory details. Pick the one you prefer.

Story 1: Making things easier for developers

If you were to survey the base applications in the Android platform, you would notice a fairly common pattern: add a little bit of magic to intercept the BACK key and do something different. To do this right, the magic needs to look something like this:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
// do something on back.
return true;
}

return super.onKeyDown(keyCode, event);
}

How to intercept the BACK key in an Activity is also one of the common questions we see developers ask, so as of 2.0 we have a new little API to make this more simple and easier to discover and get right:

@Override
public void onBackPressed() {
// do something on back.
return;
}

If this is all you care about doing, and you're not worried about supporting versions of the platform before 2.0, then you can stop here. Otherwise, read on.

Story 2: Embracing long press

One of the fairly late addition to the Android platform was the use of long press on hard keys to perform alternative actions. In 1.0 this was long press on HOME for the recent apps switcher and long press on CALL for the voice dialer. In 1.1 we introduced long press on SEARCH for voice search, and 1.5 introduced long press on MENU to force the soft keyboard to be displayed as a backwards compatibility feature for applications that were not yet IME-aware.

(As an aside: long press on MENU was only intended for backwards compatibility, and thus has some perhaps surprising behavior in how strongly the soft keyboard stays up when it is used. This is not intended to be a standard way to access the soft keyboards, and all apps written today should have a more standard and visible way to bring up the IME if they need it.)

Unfortunately the evolution of this feature resulted in a less than optimal implementation: all of the long press detection was implemented in the client-side framework's default key handling code, using timed messages. This resulted in a lot of duplication of code and some behavior problems; since the actual event dispatching code had no concept of long presses and all timing for them was done on the main thread of the application, the application could be slow enough to not update within the long press timeout.

In Android 2.0 this all changes, with a real KeyEvent API and callback functions for long presses. These greatly simplify long press handling for applications, and allow them to interact correctly with the framework. For example: you can override Activity.onKeyLongPress() to supply your own action for a long press on one of the hard keys, overriding the default action provided by the framework.

Perhaps most significant for developers is a corresponding change in the semantics of the BACK key. Previously the default key handling executed the action for this key when it was pressed, unlike the other hard keys. In 2.0 the BACK key is now execute on key up. However, for existing apps, the framework will continue to execute the action on key down for compatibility reasons. To enable the new behavior in your app you must set android:targetSdkVersion in your manifest to 5 or greater.

Here is an example of code an Activity subclass can use to implement special actions for a long press and short press of the CALL key:

@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_CALL) {
// a long press of the call key.
// do our work, returning true to consume it. by
// returning true, the framework knows an action has
// been performed on the long press, so will set the
// canceled flag for the following up event.
return true;
}
return super.onKeyLongPress(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_CALL && event.isTracking()
&& !event.isCanceled()) {
// if the call key is being released, AND we are tracking
// it from an initial key down, AND it is not canceled,
// then handle it.
return true;
}
return super.onKeyUp(keyCode, event);
}

Note that the above code assumes we are implementing different behavior for a key that is normally processed by the framework. If you want to implement long presses for another key, you will also need to override onKeyDown to have the framework track it:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_0) {
// this tells the framework to start tracking for
// a long press and eventual key up. it will only
// do so if this is the first down (not a repeat).
event.startTracking();
return true;
}
return super.onKeyDown(keyCode, event);
}

Story 3: Making a mess with virtual keys

Now we come to the story of our original motivation for all of these changes: support for virtual hard keys, as seen on the Droid and other upcoming devices. Instead of physical buttons, these devices have a touch sensor that extends outside of the visible screen, creating an area for the "hard" keys to live as touch sensitive areas. The low-level input system looks for touches on the screen in this area, and turns these into "virtual" hard key events as appropriate.

To applications these basically look like real hard keys, though the generated events will have a new FLAG_VIRTUAL_HARD_KEY bit set to identify them. Regardless of that flag, in nearly all cases an application can handle these "hard" key events in the same way it has always done for real hard keys.

However, these keys introduce some wrinkles in user interaction. Most important is that the keys exist on the same surface as the rest of the user interface, and they can be easily pressed with the same kind of touches. This can become an issue, for example, when the virtual keys are along the bottom of the screen: a common gesture is to swipe up the screen for scrolling, and it can be very easy to accidentally touch a virtual key at the bottom when doing this.

The solution for this in 2.0 is to introduce a concept of a "canceled" key event. We've already seen this in the previous story, where handling a long press would cancel the following up event. In a similar way, moving from a virtual key press on to the screen will cause the virtual key to be canceled when it goes up.

In fact the previous code already takes care of this — by checking isCanceled() on the key up, canceled virtual keys and long presses will be ignored. There are also individual flags for these two cases, but they should rarely be used by applications and always with the understanding that in the future there may be more reasons for a key event to be canceled.

For existing application, where BACK key compatibility is turned on to execute the action on down, there is still the problem of accidentally detecting a back press when intending to perform a swipe. Though there is no solution for this except to update an application to specify it targets SDK version 5 or later, fortunately the back key is generally positioned on a far side of the virtual key area, so the user is much less likely to accidentally hit it than some of the other keys.

Writing an application that works well on pre-2.0 as well as 2.0 and later versions of the platform is also fairly easy for most common cases. For example, here is code that allows you to handle the back key in an activity correctly on all versions of the platform:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
&& keyCode == KeyEvent.KEYCODE_BACK
&& event.getRepeatCount() == 0) {
// Take care of calling this method on earlier versions of
// the platform where it doesn't exist.
onBackPressed();
}

return super.onKeyDown(keyCode, event);
}

@Override
public void onBackPressed() {
// This will be called either automatically for you on 2.0
// or later, or by the code above on earlier versions of the
// platform.
return;
}

For the hard core: correctly dispatching events

One final topic that is worth covering is how to correctly handle events in the raw dispatch functions such as onDispatchEvent() or onPreIme(). These require a little more care, since you can't rely on some of the help the framework provides when it calls the higher-level functions such as onKeyDown(). The code below shows how you can intercept the dispatching of the BACK key such that you correctly execute your action when it is release.

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
if (event.getAction() == KeyEvent.ACTION_DOWN
&& event.getRepeatCount() == 0) {

// Tell the framework to start tracking this event.
getKeyDispatcherState().startTracking(event, this);
return true;

} else if (event.getAction() == KeyEvent.ACTION_UP) {
getKeyDispatcherState().handleUpEvent(event);
if (event.isTracking() && !event.isCanceled()) {

// DO BACK ACTION HERE
return true;

}
}
return super.dispatchKeyEvent(event);
} else {
return super.dispatchKeyEvent(event);
}
}

The call to getKeyDispatcherState() returns an object that is used to track the current key state in your window. It is generally available on the View class, and an Activity can use any of its views to retrieve the object if needed.

Thursday, December 17, 2009

New resources and sample code on developer.android.com

Hey Android developers—if you've visited the online Android SDK documentation recently, you may have noticed a few changes. That's right, there's a new Resources tab, which was designed to take some of the load off the Developer's Guide. We've moved a number of existing resources to the Resources tab, including tutorials, sample code, and FAQs. We've also formalized a few of our most popular developer blog posts into technical articles; watch for more of these to appear in the future.

In addition, we just released a new batch of sample code, available now as a ZIP file download on the samples index page. And we're working on updating the way in which we distribute official sample code; more on that some other time.

New sample screenshots

The new sample code includes:

  • Multiple Resolutions: a simple example showing how to use resource directory qualifiers to support multiple screen configurations and Android SDK versions.
  • Wiktionary and WiktionarySimple: sample applications that illustrate how to create an interactive home screen widget.
  • Contact Manager: an example on using the new ContactsContract interface to query and manipulate a user's various accounts and contact providers.
  • Bluetooth Chat: a fun little demo that allows two users to have a 1 on 1 chat over Bluetooth. It demonstrates how to discover devices, initiate a connection, and transfer data.
  • API Demos > App > Activity > QuickContactsDemo: a demo showing how to use the android.widget.QuickContactsBadge class, new in Android 2.0.
  • API Demos > App > Activity > SetWallpaper: a demo showing how to use the new android.app.WallpaperManager class to allow users to change the system wallpaper.
  • API Demos > App > Text-To-Speech: a sample using Text-To-Speech (speech synthesis) to make your application talk.
  • NotePad (now with Live Folders): this sample now includes code for creating Live Folders.

We hope these new samples can be a valuable resource for learning some of the newer features in Android 1.6 and 2.0. Let us know in the android-developers Google Group if you have any questions about these new samples or about the new Resources tab.

Thanks for tuning in, and 'til next time, happy coding!

Knowing is half the battle

As a developer, I often wonder which Android platforms my applications should support,especially as the number of Android-powered devices grows. Should my application only focus on the latest version of the platform or should it support older ones as well?

To help with this kind of decision, I am excited to announce the new
device dashboard. It provides information about deployed Android-powered devices that is helpful to developers as they build and update their apps. The dashboard provides the relative distribution of Android platform versions on devices running Android Market.


Android PlatformPercentage of Devices
1.10.3%
1.527.7%
1.654.2%
2.02.9%
2.0.114.8%

The above graph shows the relative number of Android devices that have accessed Android Market during the first 14 days of December 2009.

From a developer's perspective, there are a number of interesting points on this graph:

  • At this point, there's little incentive to make sure a new application is
    backward compatible with Android 1.0 and Android 1.1.
  • Close to 30% of the devices are running Android 1.5. To take advantage of this significant install base, you may consider support for Android 1.5.
  • Starting with Android 1.6, devices can have different screen densities & sizes. There are several devices out there that fall in this category, so make sure to adapt your application to support different screen sizes and take advantage of devices with small, low density (e.g QVGA) and normal, high density (e.g. WVGA) screens. Note that Android Market will not list your application on small screen devices unless its manifest explicitly indicates support for "small" screen sizes. Make sure you properly configure the emulator and test your application on different screen sizes before uploading to Market.
  • A new SDK for Android 2.0.1 was released two weeks ago. All Android 2.0 devices will be updated to 2.0.1 before the end of the year, so if your application uses features specific to Android 2.0, you are encouraged to update it to take advantage of the latest Android 2.0.1 API instead.

In summary, Android 1.5, 1.6, and 2.0.1 are the 3 versions of the platform that are deployed in volume. Our goal is to provide you with the tools and information to make it easy for you to target specific versions of the platform or all the versions that are deployed in volume.

We plan to update the dashboard regularly to reflect deployment of new Android platforms. We also plan to expand the dashboard to include other information like devices per screen size and so on.

Monday, December 14, 2009

Marissa Mayer @ Le Web 09 Paris: Google Goggles & The Future of Search

PARIS -Marissa Mayer gave another closely followed fireside interview at LeWeb 09 in Paris this year, with Michael Arrington attempting (but failing) to get her to reveal more about the new Google-branded mobile phone (set to hit the market next year).

Marissa made it very clear that Google understands that search is evolving and particularly that mobile devices are becoming the key channel for accessing search. This ties in nicely with the launch of Google Goggles, a mobile software through which anyone can take a photo with the device and let Google automatically figure out what they are looking at.

Here is a short part of the video interview:

Friday, December 11, 2009

Come to Our Virtual Office Hours

Starting this week, we're going to be holding regular IRC office hours for Android app developers in the #android-dev channel on irc.freenode.net. Members of the Android team will be on hand to answer your technical questions. (Note that we will not be able to provide customer support for the phones themselves.)

We've arranged our office hours to accommodate as many different schedules as possible, for folks around the world. We will initially hold two sessions each week:

  • 12/15/09 Tuesday, 9 a.m. to 10 a.m. PST
  • 12/17/09, Thursday 5 p.m. to 6 p.m. PST
  • 12/22/09, Tuesday 9 a.m. to 10 a.m. PST
  • 01/06/10 Wednesday 9 a.m. to 10 a.m. PST
  • 01/07/10 Thursday 5 p.m. to 6 p.m. PST

Check Wikipedia for a helpful list of IRC clients. Alternatively, you could use a web interface such as the one at freenode.net. We will try to answer as many as we can get through in the hour.

We hope to see you there!

Le Web '09 Paris-Review and Recommendations from an Official Blogger














PARIS-Wowee! What an action- and news-packed 2 days here in Paris!Loic Le Meur (& team) pulled all the stops to gather some of the most influential web entrepreneurs and thinkers in Paris at this year's show.

From Jack Dorsey of Twitter, to Chad Hurley of YouTube, Niklas Zennstrom of Skype and Marc Simoncini of Meetic, LeWeb this year truly elevated itself to being one of the leading web events worldwide. So influential was the gathering, that #leweb trended as a top topic on Twitter for 2 days running, an impressive feat on its own.Both the BBC and CNN covered the conference.

So, as official blogger of LeWeb'09 (and someone who attended the '08 edition) how can this amazing 2-day event be summed up? What were the salient points? What lessons can be learnt to make next year's event even better (not easy!)?And for those who weren't there, what did it feel like to join the world's web elite?


THE GOOD BITS

First, the good bits -the LeWeb team really did listen to the feedback from last year's edition. The Wifi network worked a treat and no-one died from hypothermia this year. The food was plentiful and the Nespresso coffee flowed freely like a mountain spring.

The speakers at this year's edition were undoubtedly top notch, and covered all the main angles , plus getting Jack Dorsey to premiere his Square payment device was a real scoop. One had a feeling that speakers were as proud to be part of LeWeb as much as Loic was proud to have them present.

The Start-up contest was great -I would say almost an event in its own right, with a great selection of startups. I was particularly impressed by Hyperwords but saw many other cool concepts.I would have liked to have seen more, but ,like many people, would have required a clone to be able to attend all the simultaneous LeWeb sessions I was interested in!

SOME FEEDBACK

Now, for the improvement opportunities...there are not many, but in the spirit of continous improvement, some are worth pointing out...the one that stands out like a sore thumb is the registration process managed by Amiando, which, frankly, was a shambles. Unlike last year, I had registered early to avoid showing up and being told my badge wasn't ready (this happened last year). So, when I saw that there was a separate, shorter queue for 'Press/Bloggers', my heart swelled. But, sadly, it was not to be. I was told that even though the sign said 'Press/Bloggers', really what they meant was 'Press'.

So, I was instructed to queue at the right 'D-F' surname section. After 30 minutes of queueing, it was my turn. 'Sorry, your badge isn't printed' was the reply when I showed my accreditation.So, back to the Helpdesk (manned by only 3 people with one printer at a conference with over 2000 attendees!!) and another 20 minutes of queueing and listening to some French swearing from other people in the queue. NOT the best way to start the day or the conference, especially when you've skipped breakfast to be at the conference venue early.

Next, the blogging process...As Official Blogger, I greatly appreciated having a dedicated space on the lower ground floor with (almost enough) power sockets and tables- many other conferences can learn a lot from this.It was fantastic!Minor points though -the process for getting bloggers' posts on the leweb main website was a little shambolic. Each blogger had to submit a link or RSS from their own blog page in order to get their post online -a much better way would have been to get their feeds from all the blogger sites in advance and link it up automatically to the main event website.

Finally, the official party at the VIPRoom was a lame duck affair, with drinks shockingly priced at €20 a pop and a venue lacking in atmosphere or entertainment value. I understand there was no sponsor -but that is no excuse. If having no sponsor means that no effort is made, then it would have been better to pull the plug on the event. Plus, I heard from attendees of earlier LeWeb editions that these parties used to be great-let's bring the old days back!

GOOD MEMORIES OF LEWEB

There were many great things about the event, so it is difficult to focus on one or two of them as best memories of the conference, but if I had to choose, I would say the salient point was the speech by Queen Rania of Jordan -impactful, up-to-date and elegant. (a queen who personally checks out her tweets-how cool is that!) A real case-study in how a public figure can change the world.

Next best, Gary Vaynerchuk shook things up nicely on stage in the second day of LeWeb with his freewheeling style and sometimes coarse language -it was good to see someone challenging the status quo and sharing contrarian views freely with the audience.

Finally, I claimed my 5 seconds of fame at LeWeb this year!At the end of the event, Loic announced some statistics on the conference (see photo above) about #no. of connected devices, #of iPhones and network usage. Low and behold, I had managed to become the data upload king of leweb, with 15.64 GB of data!!Quite an achievement at an event with 2300 expert web users all competing for bandwidth!

THANK YOU LOIC!

Overall, a big well done and thank you to Loic, Geraldine and the team for LeWeb 09 for delivering such an informative and enjoyable event. Thanks to LeWeb, Europe becomes the centre of the wired world for two days every year, an outstanding achievement by any measure.

Thursday, December 10, 2009

Optimize your layouts



Writing user interface layouts for Android applications is easy, but it can sometimes be difficult to optimize them. Most often, heavy modifications made to existing XML layouts, like shuffling views around or changing the type of a container, lead to inefficiencies that go unnoticed.

Starting with the SDK Tools Revision 3 you can use a tool called layoutopt to automatically detect common problems. This tool is currently only available from the command line and its use is very simple - just open a terminal and launch the layoutopt command with a list of directories or XML files to analyze:


$ layoutopt samples/
samples/compound.xml
7:23 The root-level <FrameLayout/> can be replaced with <merge/>
11:21 This LinearLayout layout or its FrameLayout parent is useless samples/simple.xml
7:7 The root-level <FrameLayout/> can be replaced with <merge/>
samples/too_deep.xml
-1:-1 This layout has too many nested layouts: 13 levels, it should have <= 10!
20:81 This LinearLayout layout or its LinearLayout parent is useless
24:79 This LinearLayout layout or its LinearLayout parent is useless
28:77 This LinearLayout layout or its LinearLayout parent is useless
32:75 This LinearLayout layout or its LinearLayout parent is useless
36:73 This LinearLayout layout or its LinearLayout parent is useless
40:71 This LinearLayout layout or its LinearLayout parent is useless
44:69 This LinearLayout layout or its LinearLayout parent is useless
48:67 This LinearLayout layout or its LinearLayout parent is useless
52:65 This LinearLayout layout or its LinearLayout parent is useless
56:63 This LinearLayout layout or its LinearLayout parent is useless
samples/too_many.xml
7:413 The root-level <FrameLayout/> can be replaced with <merge/>
-1:-1 This layout has too many views: 81 views, it should have <= 80! samples/useless.xml
7:19 The root-level <FrameLayout/> can be replaced with <merge/>
11:17 This LinearLayout layout or its FrameLayout parent is useless
For each analyzed file, the tool will indicate the line numbers of each tag that could potentially be optimized. In some cases, layoutopt will also offer a possible solution.

The current version of layoutopt contains a dozen rules used to analyze your layout files and future versions will contain more. Future plans for this tool also include the ability to create and use your own analysis rules, to automatically modify the layouts with optimized XML, and to use it from within Eclipse and/or a standalone user interface.


Windows users: to start layoutopt, open the file called layoutopt.bat in the tools directory of the SDK and on the last line, replace %jarpath% with -jar %jarpath%.

Queen Rania Al Abdullah @ LeWeb '09 Paris








































PARIS -Her Majesty Queen Rania Al Abdullah of Jordan delivered a passionate, inspiring and thought-provoking keynote speech at LeWeb Day 2 in Paris just before lunch. She told the audience that Real Time Web can bring real change to the humanity and asked the audience to support her 1Goal chairty in order to help children who are locked out of school.

In a well-delivered line, she noted how Twitter and other real-time applications can do what has never been done before since 'it is hard to connect with people when you are a queen'.

Queen Rania told LeWeb that the web is more human than ever before and that everyone now has the power to change things. You can find more info on how to support her charity at this link.

Tim Ferriss @ Le Web Paris 09

PARIS - Tim Ferriss started his talk here in Paris a few minutes ago saying that his original title for his bestselling book was rejected by the publisher.

He then decided to use Google to bid for varying book titles and see which one would be more popular -'The Four work week' came out trumps.

Tim says that there are 3 tipping points for attracting mass attention in the media and that you should PPC: Phenomenize, Polarize and 'Communitize'. Tim opted to pitch his book at people looking to change their lifestyle in non-traditional ways.

He also stored media-grabbing stunts (like his experiment to gain 17kg in a short space) for just prior to the book publishing date in order to obtain links to his blog or book site.

His credo is that you should market test everything before deciding on everything from the book title to the content, especially where the publisher has no initial marketing budget (like in his case).' Whatever people think is right is probably wrong', he stated.

You can try www.slinkset.com to test ideas, he said.

Videos are a great way to attract views: e.g. "how to 'peel' hard boiled eggs without peeling" or "how to be Jason Bourne".

Here is Tim's presentation:

Ferriss - Le Web 2

Wednesday, December 9, 2009

Le Web'09 Paris -Liqpay.com Start-up Contestant Video Interview

PARIS -Liqpay positions itself as a simple, but effective way to carry out financial (and other) transactions on web and mobile platforms. With a growing global customer base, this startup from Ukraine is looking to grab the headlines at LeWeb's Startup Contest.

Vitalij Kharitonskij, Liqpay developer and Kristina Chaiykovskaya, Business Developer, ran me through the main features of their service. You can see my video interview in this post later today (internet connection permitting).

If you are at Le Web, Liqpay will be presenting at 1500 in the Startup Contest area.

Tuesday, December 8, 2009

Le Web Paris ’09 Start-up Contest –16 companies jockey for #1 webpreneurship spot



PARIS- Le Web 09 edition has lined up an exciting array of 16 companies at the seed and start-up stage to promote their wares in front of its highly influential jury and public. 135 companies originally applied for the competition back in October, so only the ‘crème de la crème’ have made it through to the finals.

If you look at the full list of selected companies that will present in Paris (found here), you realise that this is a varied bunch indeed, covering areas such as cloud computing (c’est très chic right now) to social network aggregation and semantic web-style solutions.

The theme at Le Web this year is real-time web, so unsurprisingly a number of the chosen start-ups fit into this area. Notably, Sokoz, a web-based shopping portal that resembles an ebay on speed, offers item sales lasting 10 minutes with just 30-seconds for shoppers to decide whether to buy or pass up on the deal. Buyers are the ones deciding the price of each item, with the first one to click being awarded the lowest price.

Tanguy Lesselin, founder of Sokoz, says his site is all about playing while shopping, while saving time and money. With Christmas round the corner, the timing for Sokoz’s pitch is impeccable.

There are too many companies to carry out an extensive review here (and quite a few are still in private beta, so I have not been able to check them out fully) but each brings something original to the table. CloudSplit allows companies to track their cloud computing spend, FitnessKeeper lets you monitor your daily exercise routine on your iPhone, Siteheart lets you pay for items with your mobile phone, Superfeeder takes RSS feeds to the next level and Task.ly lets you manage your tasks better in an ‘all-in-one’ interface.

Mendeley will be a formidable adversary for other start-ups (and my tip for ‘one to watch’) after having convincingly won the Plugg Start-up Contest in Brussels in March (click here for my blog post on this). Backed by lastfm’s initial investor (and some of their recommendation technology magic), Mendeley allows researchers to discover, share and organize academic papers.

Personally, I am looking forward to an incroyable series of presentations next week- stay tuned for real-time updates from Paris.

(Photo credit:http://www.flickr.com/photos/jamtea/638446771/)

Thursday, December 3, 2009

Android SDK Updates

Today we are releasing updates to multiple components of the Android SDK:

  • Android 2.0.1, revision 1
  • Android 1.6, revision 2
  • SDK Tools, revision 4

Android 2.0.1 is a minor update to Android 2.0. This update includes several bug fixes and behavior changes, such as application resource selection based on API level and changes to the value of some Bluetooth-related constants. For more detailed information, please see the Android 2.0.1 release notes.

To differentiate its behavior from Android 2.0, the API level of Android 2.0.1 is 6. All Android 2.0 devices will be updated to 2.0.1 before the end of the year, so developers will no longer need to support Android 2.0 at that time. Of course, developers of applications affected by the behavior changes should start compiling and testing their apps immediately.

We are also providing an update to the Android 1.6 SDK component. Revision 2 includes fixes to the compatibility mode for applications that don't support multiple screen sizes, as well as SDK fixes. Please see the Android 1.6, revision 2 release notes for the full list of changes.

Finally, we are also releasing an update to the SDK Tools, now in revision 4. This is a minor update with mostly bug fixes in the SDK Manager. A new version of the Eclipse plug-in that embeds those fixes is also available. For complete details, please see the SDK Tools, revision 4 and ADT 0.9.5 release notes.

One more thing: you can now follow us on twitter @AndroidDev.

Monday, November 30, 2009

Announcing the Winners of ADC 2

Back in May at Google I/O, we announced ADC 2 -- the second Android Developer Challenge -- to encourage the development of cool apps that delight mobile users. We received many interesting and high-quality applications -- everything from exciting arcade games to nifty productivity utilities. We also saw apps that took advantage of openness of Android to enhance system behavior at a deep level to provide users with a greater degree of customization and utility. We were particularly pleased to see submissions from many smaller and independent developers.

Over the last couple of months, tens of thousands of Android users around the world reviewed and scored these applications. There were many great apps and the scores were very close. Together with our official panel of judges, these users have spoken and selected our winners!

I am pleased to present the ADC 2 winners gallery, which includes not only the top winners overall and in each category, but also all of the applications that made it to the top 200. There are a lot of great applications in addition to the top winners.

Thanks to everyone who submitted applications or helped us judge the entrants. We encourage all developers to submit their applications to Android Market where their app can be downloaded and enjoyed by Android users around the world.

Friday, November 27, 2009

Future of QR Codes-Japan's Colour Code Technologies















TOKYO -Colour Code Technologies showcased their patent-pending QR code innovation at the Mobile Asia Congress in Hong Kong last week.

Their innovative Colour Construct Code (CCC) is capable of storing more than x100 the amount of data of more conventional barcodes by using pixellated colours. Through their technology, QR codes can be used to encode any type of digital data without requiring an internet connection to import information.

Chris Carey, Director at Colour Code, showed me some examples of the kind of content they are converting into QR codes. One of these was the latest single by Japanese rock group, The Tenka (see photo above). By scanning the QR code on the leaflet, the software installed on a mobile phone is capable of converting the data into a song almost instantaneously.

Another advantage is that the Colour Codes can be printed on paper and stickers with inkjet printers, so reducing distribution costs and extending mass market opportunities.

Colour Code is in talks with various Japanese government agencies to use their codes for public services, for example for storing and accessing patient records in hospitals.

QR codes are extremely common in Japan and part of daily life whether you are a visitor at the airport (used at passport control) or a shopper in retail stores (commonly used for promotions).

Colour Code Technologies is therefore well positioned in its home market to deliver the necessary data storage upgrade to QR codes to allow them to meet the data hungry needs of increasingly rich media.

Wednesday, November 25, 2009

iPhone experiences of the Japanese kind


TOKYO-23rd November 2009


Before making my trip to Tokyo, I dutifully researched whether my (unlocked) iPhone would work normally in the land of the rising sun. I read internet blogs, asked friends who lived in Japan and read various on- and off-line guides.

The result was a set of conflicting viewpoints: no, it wouldn’t work at all; yes, it might work if I had the 3G or 3GS model, but only for data (not voice); and maybe it would, but on no accounts would I be able to slot in a Japanese SIM card.

So, when I landed in Japan, I wasn’t sure exactly what to expect. I was, however, able to ascertain immediately what didn’t work. A SIM card I had bought earlier in Hong Kong (and had provided commendable service over there) did not work at all.

Fighting jetlag, I decided to make it over to the nearest cellphone operator shop I could find in Tokyo. Having listened the day earlier to Softbank CEO Masayoshi Son address the Mobile Asia Congress, my autopilot navigated me to the Softbank store.

Inside, my lack of Japanese immediately led to a total inability to conduct any meaningful conversation with the customer service clerk. But, she did call a number from her phone and she connected me to an English-speaking Japanese call centre clerk.

“We are not sure if your European iPhone will work in Japan” was the answer, followed by “If you buy our SIM card, we cannot guarantee it will work”. Not the confidence-inspiring answer I was expecting.

With already 1 million iPhone users in Japan according to Fortune magazine, it is perhaps surprising that the only Japanese cellphone operator to offer the iPhone isn’t sure about network’s SIM compatibility with foreign iPhones. But then again, I mulled as I observed sushi-shaped USB sticks in the neighbouring shop window, things are a little different in Japan.

Oh, and in case you were wondering, my iPhone worked just fine in Japan with my European SIM card –not the cheapest option, but better than paying €50 to rent a Japanese cellphone for 3 days.

Tuesday, November 24, 2009

ADC 2 Public Judging is now closed

Thanks to tens of thousands of Android users around the world who participated in the review of ADC 2 finalist applications, we have now collected sufficient scores to complete Round 2 of public judging.

We are reviewing the final results and will announce the top winners this coming Monday, November 30. Thanks to all who've participated in ADC 2 and good luck to all the finalists.

Wednesday, November 11, 2009

Integrating Application with Intents

Written in collaboration with Michael Burton, Mob.ly; Ivan Mitrovic, uLocate; and Josh Garnier, OpenTable.

OpenTable, uLocate, and Mob.ly worked together to create a great user experience on Android. We saw an opportunity to enable WHERE and GoodFood users to make reservations on OpenTable easily and seamlessly. This is a situation where everyone wins — OpenTable gets more traffic, WHERE and GoodFood gain functionality to make their applications stickier, and users benefit because they can make reservations with only a few taps of a finger. We were able to achieve this deep integration between our applications by using Android's Intent mechanism. Intents are perhaps one of Android's coolest, most unique, and under-appreciated features. Here's how we exploited them to compose a new user experience from parts each of us have.

Designing

One of the first steps is to design your Intent interface, or API. The main public Intent that OpenTable exposes is the RESERVE Intent, which lets you make a reservation at a specific restaurant and optionally specify the date, time, and party size.

Hereʼs an example of how to make a reservation using the RESERVE Intent:

startActivity(new Intent("com.opentable.action.RESERVE",
Uri.parse("reserve://opentable.com/2947?partySize=3")));

Our objective was to make it simple and clear to the developer using the Intent. So how did we decide what it would look like?

First, we needed an Action. We considered using Intent.ACTION_VIEW, but decided this didn't map well to making a reservation, so we made up a new action. Following the conventions of the Android platform (roughly <package-name>.action.<action-name>), we chose "com.opentable.action.RESERVE". Actions really are just strings, so it's important to namespace them. Not all applications will need to define their own actions. In fact, common actions such as Intent.ACTION_VIEW (aka "android.intent.action.VIEW") are often a better choice if youʼre not doing something unusual.

Next we needed to determine how data would be sent in our Intent. We decided to have the data encoded in a URI, although you might choose to receive your data as a collection of items in the Intent's data Bundle. We used a scheme of "reserve:" to be consistent with our action. We then put our domain authority and the restaurant ID into the URI path since it was required, and we shunted off all of the other, optional inputs to URI query parameters.

Exposing

Once we knew what we wanted the Intent to look like, we needed to register the Intent with the system so Android would know to start up the OpenTable application. This is done by inserting an Intent filter into the appropriate Activity declaration in AndroidManifest.xml:

<activity android:name=".activity.Splash" ... >
...
<intent-filter>
<action android:name="com.opentable.action.RESERVE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="reserve" android:host="opentable.com"/>
</intent-filter>
...
</activity>

In our case, we wanted users to see a brief OpenTable splash screen as we loaded up details about their restaurant selection, so we put the Intent Filter in the splash Activity definition. We set our category to be DEFAULT. This will ensure our application is launched without asking the user what application to use, as long as no other Activities also list themselves as default for this action.

Notice that things like the URI query parameter ("partySize" in our example) are not specified by the Intent filter. This is why documentation is key when defining your Intents, which weʼll talk about a bit later.

Processing

Now the only thing left to do was write the code to handle the intent.

    protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Uri uri;
final int restaurantId;
try {
uri = getIntent().getData();
restaurantId = Integer.parseInt( uri.getPathSegments().get(0));
} catch(Exception e) {
// Restaurant ID is required
Log.e(e);
startActivity( FindTable.start(FindTablePublic.this));
finish();
return;
}
final String partySize = uri.getQueryParameter("partySize");
...
}

Although this is not quite all the code, you get the idea. The hardest part here was the error handling. OpenTable wanted to be able to gracefully handle erroneous Intents that might be sent by partner applications, so if we have any problem parsing the restaurant ID, we pass the user off to another Activity where they can find the restaurant manually. It's important to verify the input just as you would in a desktop or web application to protect against injection attacks that might harm your app or your users.

Calling and Handling Uncertainty with Grace

Actually invoking the target application from within the requester is quite straight-forward, but there are a few cases we need to handle. What if OpenTable isn't installed? What if WHERE or GoodFood doesn't know the restaurant ID?



Restaurant ID knownRestaurant ID unknown
User has OpenTableCall OpenTable IntentDon't show reserve button
User doesn't have OpenTableCall Market IntentDon't show reserve button

You'll probably wish to work with your partner to decide exactly what to do if the user doesn't have the target application installed. In this case, we decided we would take the user to Android Market to download OpenTable if s/he wished to do so.

    public void showReserveButton() {

// setup the Intent to call OpenTable
Uri reserveUri = Uri.parse(String.format( "reserve://opentable.com/%s?refId=5449",
opentableId));
Intent opentableIntent = new Intent("com.opentable.action.RESERVE", reserveUri);

// setup the Intent to deep link into Android Market
Uri marketUri = Uri.parse("market://search?q=pname:com.opentable");
Intent marketIntent = new Intent(Intent.ACTION_VIEW).setData(marketUri);

opentableButton.setVisibility(opentableId > 0 ? View.VISIBLE : View.GONE);
opentableButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
PackageManager pm = getPackageManager();
startActivity(pm.queryIntentActivities(opentableIntent, 0).size() == 0 ?
opentableIntent : marketIntent);
}
});
}

In the case where the ID for the restaurant is unavailable, whether because they don't take reservations or they aren't part of the OpenTable network, we simply hide the reserve button.



Publishing the Intent Specification

Now that all the technical work is done, how can you get other developers to use your Intent-based API besides 1:1 outreach? The answer is simple: publish documentation on your website. This makes it more likely that other applications will link to your functionality and also makes your application available to a wider community than you might otherwise reach.

If there's an application that you'd like to tap into that doesn't have any published information, try contacting the developer. It's often in their best interest to encourage third parties to use their APIs, and if they already have an API sitting around, it might be simple to get you the documentation for it.

Summary

It's really just this simple. Now when any of us is in a new city or just around the neighborhood its easy to check which place is the new hot spot and immediately grab an available table. Its great to not need to find a restaurant in one application, launch OpenTable to see if there's a table, find out there isn't, launch the first application again, and on and on. We hope you'll find this write-up useful as you develop your own public intents and that you'll consider sharing them with the greater Android community.

Monday, November 9, 2009

Google Acquires AdMob-what say you, mobile?



AdMob announced today in a mailing to its customers that it was being acquired by Google for $750m.



"After our deal closes, AdMob will work with Google to accelerate the pace of innovation in mobile and do an even better job for you. We believe this deal will benefit our developer and publisher partners by:

Building even more powerful technology and tools to monetize mobile traffic.

Increasing the effectiveness of display advertising on mobile devices by leveraging Google sales team, infrastructure and relationships.

Improving the already high level of service and support we deliver to our publishers."





said Omar Hamoui, from AdMob in his email earlier today.



But what does this mean for mobile advertising?



Google's logic for making the deal is to ramp up its position in mobile advertising, seeing that growth in this ad market is likely to be higher than in traditional Pc-based web. It also can be interpreted as a sign that its own AdSense product for mobile was not sufficient in itself to give Google the edge in this market.



Where Google can really innovate is in the area of location based advertising on mobile, by stepping in the gap being left wide open by all the big mobile ad networks (who have capability to deploy LBS ads but lack the commitment from other members of the mobile ecosystem). It is no secret that Google has the best generic mapping product in the market (which was also skilfully deployed on mobile).



By combining its current capabilities with its web know-how and AdMob's mobile ad network, Google is now in a great position to transform the market and can deploy quickly, thanks to its Android platform.





Related Posts Plugin for WordPress, Blogger...