Announcing the Android 1.0 SDK, release 1

About this time last year, my colleagues and I were preparing for the first of the "early look" SDK releases. I remember being a little freaked out—November 12 was starting to sound awfully close! But I think I can safely speak for the entire Android team when I say that we were all very excited about that upcoming release. In the year since, we've run and concluded the first Android Developer Challenge, given away $5,000,000, released more SDK builds, and worked with our partners to prepare the first device for users. It's been quite the whirlwind of a year.

In one of those strange cosmic symmetries, here we are a year later, and we're once again very excited about an upcoming release. I'm referring, of course, to the first Android-powered device that our colleagues at T-Mobile have just announced—the T-Mobile G1. We can't wait to see our hard work on store shelves and in the hands of users, but today we're almost as excited because we're announcing the brand-new Android 1.0 SDK, release 1.

Yes, that means we're officially at 1.0. Of course the SDK won't remain static—we'll keep improving the tools by adding features and fixing bugs. But now developers can rely on the APIs in the SDK, and can update their applications to run on Android 1.0-compatible devices. The Android Market beta will also launch with the T-Mobile G1, providing developers an easy and open way to distribute their applications on that and later devices. I've already seen a lot of applications that have me stoked, and I can't wait to see things really come together as developers cross that final mile to prepare their applications for Android 1.0.

So what's next for us? Well, we'll keep working on the SDK, as I said. But we're also working hard with our partners in the Open Handset Alliance on the open-source release, with the aim of making the code available in the fourth quarter. The second Android Developer Challenge is also on the horizon—watch this space for more details. We're also already working on the future of the Android platform, and on more devices. We've updated the Developer Roadmap, and we'll keep updating it as more information becomes available.

It has indeed been quite an exciting road to get to where we are today. The road stretches on ahead though, and we're not slowing down for a moment. I look forward to meeting and working with many of you developers out there—and trying out your apps on my phone!

Happy Coding!

Google on Android

At Google, we develop products that we love to use ourselves. For example, we're avid users of Search, Gmail, Maps, and many others. But for those of us in mobile, it's tough. Not all products work the same on all devices, and although we try and optimize for each device, we often run into challenges specific to certain mobile phone platforms. I, for one, used to carry three devices with me all day. I love my iPhone for its powerful browser and music player. I use my BlackBerry for Gmail and Calendar (and occasionally Brick Breaker), and I carry a Nokia N-series phone because of its camera and YouTube application.

The first Android-powered phone, announced today by T-Mobile, comes 'with Google'. The following Google applications are preloaded on the device: Search, Maps, Gmail with Contacts, Calendar, Google Talk, and YouTube. There are a few things I'm particularly excited about:
  • Easy to use. It's never been easier to use Google on your phone. With single sign-in, you can log in to your Google account and have instant access to all your favorite Google products. No messing around with settings, your login never expires, and everything just works. If you don't have a Google account yet, you can set one up on your phone and be up and running in seconds.
  • Fully synchronized. Your emails, contacts, calendar entries, Google Talk chats are fully synchronized with Gmail and Calendar on the web. New events are pushed in real-time to your phone and any changes you make on-the-go are immediately available on the web. If you ever lose or break your phone, all your data is safe and secure in the cloud.
  • Designed to work together. Search is now available as a feature in many applications, including non-Google ones, such as the music player. While you're listening to a song -- like something from Depeche Mode -- just 'long-press' the artist's name. You'll see a menu pop up that let's you search Google for the Depeche Mode Wikipedia entry, or search YouTube for the music video. The contact application lets you see your friend's IM status, view his address on a map, and communicate with him using Gmail or Google Talk. And, of course, you can call or text him as well.
Check out the video below to see these features in action:



The Google applications on Android take full advantage of the features of the Android platform. Gmail is built on 'embedded WebViews', the real-time push features and synchronization use the multi-tasking capabilities of the platform, and the integration between applications relies on the 'Android Application Framework'.

We're kicking off a new blog series, called 'Google on Android'. Over the next couple of weeks, we will dig deeper into each one of the Google applications available for Android, and at the end of the series, I'll let you know whether I've decided to switch phones or switch to pants that let me carry four phones instead of three.

Get public transit directions in New York with Google Maps for mobile

Now that Google Maps can give you subway, train, bus, and ferry directions in New York City, it's a handy tool for planning a night on the town. But what if your plans change while you're at dinner?

Luckily, Google Maps for mobile can give you the same public transit directions right on your cell phone! You can plan trips throughout the New York metro area, including turn-by-turn walking directions. With the My Location feature, most cell phones can automatically set the starting point for your trip, even without GPS. And satellite view and Street View (on selected devices) can show you a preview of where you're going.

With Google Maps for mobile in your pocket, you can go wherever the evening takes you, secure in the knowledge that it'll be easy to figure out how to get there. Google Maps for mobile with public transit directions is available for Blackberry, Windows Mobile, Symbian Series 60, and many Java-based phones. Download it by visiting http://m.google.com/nyc in your mobile phone's browser.

Panoramio

The Panoramio web site has a great collection of photos from all over the world, and they also have a very convenient web API. I thought it would be a lot of fun to use Android to access this content while you are out walking around – and especially to have Android find interesting photos based on your current location. The resulting open source application is now available in the apps-for-android project.

The application starts by showing your current location in a custom MapView. You can pan and zoom this map to choose the area you want to search.

Once you have selected a search area, the application downloads thumbnails of the most popular photos taken within that area:

You can tap on an item to see more details.

From here you can use the menu to find more pictures by the same photographer or to see the original photo on the Panoramio site. My two favorite features, though, help you find the location of the photo in the real world. You can show the location on the map along with your current location:

Or, you can bring up a radar view that uses the compass and GPS to show you the location of the photo in relation to your own location:

I thought that other applications might want to use the radar view for their own purposes ("find me the nearest taqueria"), so I split that into its own package. You can find the source for that in the Radar project. Of course, you don't need the source in order to use this feature. Because of Android's component architecture, all you need to do us use an Intent:

Intent i = new Intent("com.google.android.radar.SHOW_RADAR");

i.putExtra("latitude", 37.422f);

i.putExtra("longitude", -122.084f);

startActivity(i);

The code for these applications is not very long, but they are a good example of how to use a number of Android's location APIs:

Using WebViews

I've written a small application called WebViewDemo that shows how you can add web content to your application. You can find it in the apps-for-android project. This application demonstrates how you can embed a WebView into an activity and also how you can have two way communication between your application and the web content.

A WebView uses the same rendering and JavaScript engine as the browser, but it runs under the control of your application. The WebView can be full screen or you can mix it with other Views. The content for your WebView can come from anywhere. The WebView can download content from the web, or it can come from local files stored in your assets directory. The content can even be dynamically generated by your application code. For this example, the HTML comes from a local file called demo.html.

This application does not do very much: when you click on the android, he raises his arm.

This could, of course, easily be accomplished with a little bit of JavaScript. Instead, though, WebViewDemo takes a slightly more complicated path to illustrate two very powerful features of WebView.

First, JavaScript running inside the WebView can call out to code in your Activity. You can use this to have your JavaScript trigger actions like starting a new activity, or it can be used to fetch data from a database or ContentProvider. The API for this is very simple: just call the addJavascriptInterface method on your WebView. You pass an object whose methods you want to expose to JavaScript and the name to use when making calls. You can see the exact syntax in WebViewDemo.java. Here we are making our DemoJavascriptInterface object available to JavaScript where it will be called "window.demo".

Second, your Activity can invoke JavaScript methods. All you have to do is call the loadUrl method with the appropriate JavaScript call:

mWebView.loadUrl("javascript:wave()");

Our WebViewDemo uses both techniques: when you click on the android, it calls out to the activity, which then turns around and calls back into the JavaScript. WebViews are very powerful, and they may be a valuable tool to help you build your application – especially if you already have a lot of HTML content. As it happens, we've used exactly this approach in some of the applications we've written.

Street View and walking directions come to Google Maps for mobile

This July, Street View went international for the Tour de France, and in August, expanded coverage to Japan and Australia. Now, Street View is coming to another new frontier: your phone.

Today we're launching a new version of Google Maps for mobile with the same street-level imagery available on desktop. Wondering if the restaurant in your search results is the one you're thinking of? Just click "Street View" after your search to see the storefront. Unsure about a complicated intersection in your directions? Use Street View to see a photo, so there's no mistaking your turn. You can also launch Street View from any address where we have photography, or simply by clicking on the map and selecting "Street View". You can browse Street View overlaid on the map or in full screen, rotate your view to see more of your surroundings, and move along the street.

We've also added other features to help you search for and get to businesses and locations. You can now read business reviews, so you'll know if it's actually worth driving across town to that store. And once you decide where to go, you can get there on foot using the same walking directions (beta) we recently launched on desktop. Finally, we hope you'll notice significant improvements in search speed with this version, as well as better location accuracy in all versions thanks to this week's My Location update.

Check out this video to see the new release of Google Maps for mobile in action:



The newest Google Maps for mobile is available now for BlackBerry and many Java-enabled phones. To download it to your phone, visit google.com/gmm from your phone's web browser or on the desktop. We're working on bringing all these new features to other platforms as well, so stay tuned.

Posted by Michael Siliski, Product Manager

My Location: smaller is better!

My Location just got better for all the applications that use Google's geolocation service!

In November 2007 we launched My Location on Google Maps for mobile, and in the past few months, we've location-enabled other applications from third parties and Google. Hundreds of location-enabled iPhone applications, including the Google Mobile App, use Google's database of cell towers to determine approximate location. And just last week we announced Mobile Search with My Location, powered by the Gears Geolocation API.

With today's launch, your location estimate will be centered closer to your true location, and we have also improved the calculation of just how good our estimate is. When we originally launched the "blue circle" on Google Maps for mobile, the circle usually stayed the same size no matter if you were in downtown Manhattan or rural Iowa. Now, the next time you're using Google Maps in downtown Manhattan, expect to see a much smaller circle that's also far more accurate. Conversely, when you're in a lightly populated area like rural Iowa, expect to see a much larger circle which also happens to be centered closer to your true location. Check out these screenshots to get a better idea of the before and after effects of today's change:

New York City -- a smaller light blue circle denotes that we're more confident of your actual location.




Slater, Iowa - the light blue circle is larger because there are fewer cell towers with which to determine your location, but the dark blue circle is more accurately centered in downtown Slater


So how exactly have we made these improvements? Mobile operators typically need a lot more cell towers in populous areas to service all the users. This means each individual tower provides a much smaller coverage footprint. On the other hand, in a very sparsely populated area, towers provide much larger coverage footprints. We've developed algorithms to try and figure out what the right circle size should be and are pleased to make this available to you today.

There's actually nothing you need to do to start enjoying the new improvements to My Location. Any application powered by Google's geolocation service automatically benefits from today's launch. Enjoy!

Posted by Zhengrong Ji, Software Engineer

Divide and Conquer

Years ago I was addicted to a simple game that I played on my then state-of-the-art Pentium-75. In this game, balls would bounce around, and I would try to partition them into small enough spaces so that I could go to the next level where more and more balls would be added. As of a couple of months ago, for the life of me, I couldn't remember the name of this game. So when I sat down to write an application for Android in my 20% time, I thought, why not try to recreate something similar? After completing most of the game and showing it to some of my friends at work, one of them said, "Oh, this reminds me of JezzBall!" Eureka! If working on this game does nothing more than reveal the name of one of the favorite games of my youth, I'll call it a success, but in the meantime, I'm happy to announce that the source of this application, named Divide and Conquer, is now available on apps-for-android.


The game starts with instructions:



and begins simply enough with one ball bouncing around. You drag your finger in a horizontal or vertical gesture on the screen to initiate a line that extends until it reaches the edges:




In each level, once you've shaved off 80% of the original area, you move to the next level. Here's a screen shot of level 6:


If a ball hits a line in progress, you lose a life:



Once you are out of lives, it is game over:



While this game isn't going to win any awards for cutting edge graphics, it demonstrates use of several Android features and APIs:


  • custom drawing and animation
  • touch input based gesture detection

  • overriding the default behavior of the back key in some situations (to pause the game)

  • creating custom Dialogs

  • configuring an application to be full screen with no title or status bar
  • use of the preferences framework

  • use of the vibrator API

DivideAndConquerView is a custom View that implements its own onDraw method using the Canvas methods, and gesture detection using onTouchEvent and a helper class DirectionPoint. It keeps track of the state of the game using BallEngine, and reports relevant events back to the main activity of the application, which, in turn, keeps track of and controls the state of the game. The application is configured to be full screen in its AndroidManifest.xml file.

Introducing Mobile Search with My Location

From time to time, we all need information about local businesses when we're away from our computers -- like confirming the address of a bar while on the way to meet friends. Today we're introducing Search with My Location, a new way to make searching for nearby businesses on your Windows Mobile phone faster and easier.

Previously, when you went to google.com from your phone’s browser and performed a local search, the results were tailored to the last location you entered. Now, using the Gears Geolocation API, Search with My Location approximates your actual location using the same Cell ID technology used by Google maps for mobile. So if you want to find sushi nearby, just type "sushi" and Google will return local business listings around you. If you want to know the forecast, type "weather". If you want to search somewhere else, specify a location in the query like "pizza Kansas City".

We take your privacy seriously and have designed Search with My Location so that it doesn't associate your location with any personally identifiable information, even if you are logged in. We won’t send your location until you explicitly opt in, and you can always opt-out from the Gears Settings under the Tools menu.

Note that some devices don't yet support My Location. For this reason, we’re initially launching the feature on the devices listed in this help center article while we work with manufacturers to add support to future phone versions.

Initially, Search with My Location will be available in the US and UK. To get started, visit google.com from your phone and click on the My Location link under the search box (you may have to refresh the page to see the link). Enjoy the new feature and check out the video to see how Search with My Location can help save your thumbs!



Three new Samples: Triangle, SpriteText and Downloader

I've posted three new open source samples to the apps-for-android project: Triangle, SpriteText and Downloader.


The first two samples, Triangle and SpriteText, show techniques that would be useful to anyone using the OpenGL ES 3D graphics APIs to write Android applications. The samples contain several reusable classes that may eventually be incorporated (in some form) into the SDK. Chief among these is the GLView class, which abstracts the OpenGL ES book-keeping code from the rest of the application. GLView helps handle the extra work OpenGL ES applications have to do when the activity is paused and resumed, and when the display goes to sleep and wakes up. In the Pause/Resume case the OpenGL surface has to be recreated. In the display sleep / wake-up case the entire OpenGL context has to be recreated.

Triangle

The first sample, Triangle, shows how to use the GLView class and the OpenGL ES 3D library to display a spinning textured triangle. Think of it as the "hello, world" of OpenGL ES apps. Because it's relatively simple, it's a good place to start when experimenting with the OpenGL ES API.


SpriteText

The second sample, SpriteText, shows how to efficiently display screen-aligned text using the GL11Ext.glDrawTexiOES method. SpriteText contains a reusable LabelMaker class for drawing static text and screen-aligned images, as well as a Projector class for finding the 2D screen coordinates corresponding to a 3D point, and a MatrixTrackingGL class for keeping track of the current transformation matrix. Finally, it shows how to use these classes to display a milliseconds per frame counter. A ms/f counter can be helpful for tuning graphics performance.


Downloader

The third sample, Downloader, shows how to add a downloader activity to your application. The downloader activity runs at the beginning of your application and makes sure that a set of files have been downloaded from a web server to the phone's SD card. Downloader is useful for applications that need more local data than can fit into an .apk file. For example a game could use Downloader to download the game's artwork, sound effects, and level data. The Downloader activity is designed to be a drop-in addition to your application. You customize it by supplying the URL of an XML configuration file which lists the data files that need to be downloaded.

Google Mobile App for BlackBerry: faster, stronger, better

Today we're pleased to launch Google Mobile App for BlackBerry. It's a free download and it looks like this:
To download the App, visit m.google.com on your BlackBerry device.

Once it's installed you'll have faster search and easy access to Maps, Gmail, News, and more from Google.

So what exactly will you get?
  • Fast Google search - enter queries without waiting for a browser to load
  • Search history - easily access and amend your previous queries
  • Google Suggest - complete queries with less typing
  • Easy access to Google products for your phone - click once to download and install our applications for BlackBerry, and get immediate access to our web-based services
  • Google Apps support - get direct links to your Google Apps Calendar and Documents/Spreadsheets (select Menu, Options, Use Google Apps Domain: yes, and then enter your domain name)
  • Update alerts - learn about new versions of downloadable Google mobile applications and upgrade with just one click (Google Mobile App replaces Google Updater for BlackBerry)
We hope you'll enjoy using Google Mobile App.

A final tip - you can make it even easier to get all of this whenever you need it... just assign Google Mobile App to a convenience key using these instructions.

Android Photostream

I'm pleased to announce that a new open source sample application—called Photostream—has been added to the apps-for-android project. Photostream is a simple photos browser and viewer for Flickr. All you need to use it is a Flickr screen name or user name (the application offers a default user name if you just want to try it.)



This application serves as an illustrative example of several Android features and APIs:


  • Activity aliases

  • Adding custom shortcuts to Home

  • Adding a new wallpaper chooser to the system

  • Custom layouts

  • Custom XML attributes

  • Use of themes

  • Use of styles

  • Use of text colors

  • Use of <include>

  • Use of bitmap and layer drawables from XML

  • Use of HttpClient

  • Proper interaction between background threads and the UI thread

  • Efficient display rotation (using the new onRetainNonConfigurationInstance() API)

  • Animations and layout animations

  • Cropping an image

  • Image manipulation





My favorite feature is the ability to add a new shortcut type in Home, to create a shortcut to any Flickr account. The shortcut shows a custom icon, downloaded from the Flickr user profile:





If you plan on reusing the source code to access Flickr in your own application, you should modify the Flickr.java file to replace the existing API key with your own. The application source code also contains a very handy class called UserTask.java. This class is designed to help you easily write background operations that interact with the UI thread.