Fast is better than slow



A few weeks ago, we launched a plug-in for Symbian devices that put a Google search shortcut onto the phone's home screen. This shortcut reduces the time it takes for you to get answers from Google by eliminating the initial search steps (e.g. finding the browser application, opening it, and navigating to Google.com before entering your query). The same plug-in has been available for BlackBerry devices since last December. Today, we're making this available for Windows Mobile devices too.

If you're a Windows Mobile user, browse to mobile.google.com on your device to download the plug-in and start searching faster than ever. Once you do, we think you'll find it so much faster and easier that you'll start conducting more mobile web searches than you ever had before. How do we know this? Well, when we look at the combined usage numbers for BlackBerry and Symbian versions of this plug-in, we see that users are able to get Google search results up to 40 percent faster. And, BlackBerry and Symbian users with the plug-in installed search 20 percent more than those without it.

We saw something similar after we launched an updated interface for Gmail on the iPhone during MacWorld earlier this year. Lots of iPhone users tried the new interface (hence the bump in Gmail pageviews between January and February), but they didn't stick around like we hoped they would. Over the course of the next few weeks, we made some tweaks to drastically improve the speed of the product, and Gmail pageviews on the iPhone not only stabilized, but began to rise, as the graph below shows:
This link between increased usage and a faster user experience -- be it search or mobile Gmail -- reinforces something we at Google have known for a long time: Fast is better than slow. With mobile applications, we're seeing that fast is much better than slow. Although this may seem pretty intuitive, it's always nice to see new data backing this up. Moving forward, we'll continue to focus on bringing you the fastest and most compelling mobile experiences that we can. So stay tuned!

Linkify your Text!

This is the first in a series of technical articles about WikiNotes for Android, part of the Apps for Android project.



This article covers the use of Linkify to turn ordinary text views into richer link-oriented content that causes Android intents to fire when a link is selected.



Linkify: The Linkify class in the SDK is perfect for creating a wiki note pad. This class lets you specify a regular expression to match, and a scheme to prepend. The scheme is a string that, when the matched text is added, forms a Content URI to allow the correct data to be looked up.



For example, in our case we want to look for a regular expression match for a WikiWord (that is, a word with camel case and no spaces). Linkify can then turn this into a Content URI - something like >content://com.google.android.wikinotes.db.wikinotes/wikinotes/WikiWord which can then be used to locate the correct wiki page from a content provider.



As a bonus, the Linkify class also defines several default matches, in particular it is able to turn web URLs, email addresses and telephone numbers into active links which fire Android intents automatically.



Linkify can be passed any TextView in your application, and will take care of creating the links and enabling their "clickability" for you.



Default Linkify: Using the set of default active link options is very straightforward - simply pass it a handle to a TextView with content in it, and the Linkify.ALL flag:



TextView noteView = (TextView) findViewById(R.id.noteview);
noteView.setText(someContent);
Linkify.addLinks(noteView, Linkify.ALL);


and that's it. The Linkify.ALL flag applies all of the predefined link actions, and the TextView will be immediately updated with a set of active links which, if you select them, fire default intents for the actions (e.g. a web URL will start the browser with that URL, a telephone number will bring up the phone dialer with that number ready to call, etc.).



Custom Linkify: So what about our WikiWord? There is no pre-defined action for that, so it needs to be defined and associated with a scheme.



The first task is to defined a regular expression that matches the kind of WikiWords we want to find. The regex in this case is:



\b[A-Z]+[a-z0-9]+[A-Z][A-Za-z0-9]+\b


Obvious no? Well actually this is equivalent to the following description: "Starting with a word boundary (the \b) find at least one upper case letter, followed by at least one lower case letter or a numeric digit, followed by another upper case letter, and then any mix of upper case, lower case or numeric until the next word boundary (the final \b)". Regular expressions are not very pretty, but they are an extremely concise and accurate way of specifying a search pattern.



We also need to tell Linkify what to do with a match to the WikiWord. Linkify will automatically append whatever is matched to a scheme that is supplied to it, so for the sake of argument let's assume we have a ContentProvider that matches the following content URI:



content://com.google.android.wikinotes.db.wikinotes/wikinotes/WikiWord


The WikiWord part will be appended by Linkify when it finds a match, so we just need the part before that as our scheme.



Now that we have these two things, we use Linkify to connect them up:



Pattern wikiWordMatcher = Pattern.compile("\\b[A-Z]+[a-z0-9]+[A-Z][A-Za-z0-9]+\\b");
String wikiViewURL = "content://com.google.android.wikinotes.db.wikinotes/wikinotes/";
Linkify.addLinks(noteView, wikiWordMatcher, wikiViewURL);


Note that the \b's had to be escaped with double backslashes for the Java Pattern.compile line.



Linkify can be used multiple times on the same view to add more links, so using this after the Default Linkify call means that the existing active links will be maintained and the new WikiWords will be added. You could define more Linkify actions and keep applying them to the same TextView if you wanted to.



Now, if we have a WikiWord in the TextView, let's say MyToDoList, Linkify will turn it into an active link with the content URI:



content://com.google.android.wikinotes.db.wikinotes/wikinotes/MyToDoList


and if you click on it, Android will fire the default intent for that content URI.



For this to all work, you will need a ContentProvider that understands that Content URI, and you will need a default activity capable of doing something with the resulting data. I plan to cover these in future blog entries (and soon). In fact, the whole Wiki Note Pad application is currently undergoing some clean up and review, and will then hopefully be released as a sample application.

Fast tip: one-click access to Google mobile applications on your phone



I've heard it said that user interfaces are measured in "hurts." Here at Google we like things to be as painless as possible. That's why we're happy to share a little-known feature of many phones that allows you to launch your favorite app (hopefully Google Maps!) with the press of a button.

Buried in the settings menu of many phones is the option to configure "convenience keys" (or "sidekeys," or "shortcuts," depending on the device). Convenience keys let you configure a physical key, usually on the side of your phone, to instantly launch whatever application you choose. For instance, here are some instructions for how to configure a BlackBerry, Blackjack, and Nokia N95 for one-click access to Google Maps for mobile:

BlackBerry 8800: Go to Options->Screen/Keyboard->Convenience Key -> select 'Google Maps'
Samsung BlackJack: Select 'Settings' icon ->More ->Key settings ->Side key settings ->Select 'Google Maps'
Nokia N95: Press the 'Menu' button ->Tools ->Settings ->Personalization ->Standby mode ->Shortcuts ->Left/Right selection key -> Select 'Google Maps'

In the video below Steve Lee and I show you how to set up these quick access keys. Be sure to catch our death-defying duel at the end of the video, where one of us bites the dust while the other hurls obscure movie references.

Finally, if you use shortcut keys on other phones please submit a comment below so that others can give them a try.

Android Developer Challenge Deadline Approaching Quickly

The Android Developer Challenge is proceeding nicely. We're excited about the interest people have shown so far and have enjoyed talking to everyone working on new Android Apps.

As a quick reminder, the first phase of the challenge will be ending on April 14. In the Android Developer Challenge I, the 50 most promising entries received by April 14 will each receive a $25,000 award to fund further development. Those selected will then be eligible for even greater recognition via ten $275,000 awards and ten $100,000 awards.

Keep working on your applications, and be sure to post in the forums if you have any questions!

Announcing: Apps for Android

Screenshot of WikiNotes for AndroidWe are pleased to announce that a new open source project has been created on Google code hosting called apps-for-android. Our goal is to share some sample applications that demonstrate different aspects of the Android platform.



The first application to be included in the new project is called WikiNotes for Android.



For anyone not familiar with the concept of a wiki, it is a simple way to link up pages of information using WikiWords (words that use CamelCase). For example, in the previous sentence, both WikiWords and CamelCase would become live links in a Wiki, and would take you to pages of information.



WikiNotes for Android is a form of wiki known as a personal wiki. These run on desktops or (in this case) mobile computing devices, and many people like them. They bring a bit more structure to your notes than just a list of subjects. You can choose to link notes or pages up in any manner you like.



This particular implementation uses a regular expression to match WikiWords and turn them into links that fire Intents to go to other notes. Because of the way the links are implemented, the application will also create links out of telephone numbers that take you to the dialer and URLs that start up the browser.



Search by title and content is also implemented, so even if you forget the structure, you can still find that all-important note about where you left your car in the airport car park.



This wiki has a view mode and an edit mode. In view mode, the links become active and allow you to navigate to other notes, or to other activities like dialer and web browser. In edit mode, you see a plain text view that you can edit, and when you confirm the changes it goes back to view mode. There is both a menu entry and keyboard shortcut to switch to edit view, so that you can very quickly make changes. And, if you get lost in the note structure, there is also an option to take you back to the start page.



WikiNotes for Android was written to demonstrate a number of core concepts in Android, including:




  • Multiple Activities in an Application (View, Edit, Search, etc.)

  • Default intent filters for View/Edit/Search based on MIME types

  • Life cycle of Activities

  • Message passing via Bundles in Intents

  • Use of Linkify to add Intent-firing links to text data

  • Using Intents within an application

  • Using Intents to use an Activity within another application

  • Writing a custom ContentProvider that implements search by note title

  • Registration of ReST-like URIs to match titles, and do contents searches

  • SQLite implementations for insert, retrieve, update, delete and search

  • UI layout and creation for multiple activities

  • Menus and keyboard shortcuts



The application remains small in size and features to make it easy to understand. In time, more features will be added to the application to make it more useful, but a sample version with the minimal functionality will always be available for developers new to the Android platform.



If you believe that firing an Intent for every link that is clicked is sub-optimal and will waste resources, please take a look at the running application using DDMS. You will see how efficiently Android re-uses the running Activities and indeed, this is one of the main reasons WikiNotes for Android was written. It demonstrates that using the Android Activities and Intents infrastructure not only makes construction of component-based applications easy, but efficient as well.



There will also be a series of technical articles about the application right here on the Android Developer blog.



And please, keep an eye on the apps-for-android project, as more sample applications will be added to it soon.



Happy wiki-ing.

Shifting Google Gears to mobile



Ever use a mobile web application and suddenly lose your cell connection? That's happened to me many times. If you've shared my pain, you'll be excited to know that we've launched Google Gears for mobile, which lets users access Gears-enabled mobile web apps offline. Initially available for Internet Explorer Mobile on Windows Mobile 5 and 6 devices, mobile web app developers have already started integrating Gears for mobile into their online services.

Take Zoho and Buxfer, for example: Zoho is a powerful suite of web-based productivity applications, while Buxfer is an innovative personal finance web application that helps you track your money. With Google Gears for mobile integrated into mobile Zoho and Buxfer, you can now access these web applications even when your phone is disconnected from the mobile web. Stuck on a plane? No problem — you can still read your docs on your mobile with Zoho Writer Mobile offline. Want to buy that new plasma TV, but can't remember how much is in your account? Check your balance with Buxfer's mobile web application, even if there is no cell phone signal. Try them out on your Windows Mobile 6 device by going to m.buxfer.com or mobile.zoho.com.

When you first access mobile Buxfer or Zoho Writer on your Windows Mobile device and go offline, you will be asked to install Google Gears for mobile. Once installed, Gears sits happily on your phone helping you stay connected to your data -- even when you lose your network connection.

If you're a developer who's interested in creating mobile web applications using Google Gears for mobile you can find out more information on our developer site. Finally, if you're not a Windows Mobile user, stay tuned -- we're working to roll out Google Gears for other platforms with capable web browsers, including Android.

Android SDK update: m5-rc15 released

Earlier today we released an update to the Android SDK – we're calling it m5-rc15. With this update, the SDK now includes all of the incremental changes we've been making to the online documentation since m5-rc14 was released in mid-February. In addition to the latest documentation, we've also fixed a security issue involving handling of image files.



We recommend that you install m5-rc15 at your earliest convenience. The update doesn't change any of the Android APIs or introduce any new ones. Eclipse users don't need to update the ADT plug-in either.



Once you've unzipped the file on your machine, you will want to update things like your PATH variable and, if you're using Eclipse, the SDK location setting for ADT (hint: Preferences > Android).