Tuesday, October 26, 2010

In order to encourage a new generation of TV developers to come forward, Google are planning to give away 10,000 Google TV devices to help developers start building for TV.

In Adobe MAX conference, Google gave away more than 3,000 Google TV devices to attendees. Additionally, Google will be reaching out to thousands of web developers in the Google Code community to offer them a free device. Finally, if you are a professional web developer who wants to help make the Google TV experience even better and you don’t happen to fall into one of those two groups, you can submit an entry to our Google TV Web Developer Promotion and include a short summary about the type of interesting website your company would like to create or optimize for Google TV. Google are planning to select 2,500 winners from those entries to receive a free Google TV device.

To get started building websites for Google TV, we’ve provided new documentation and a Google TV Web forum to help developers better engage in the process. We’re excited to see what you all come up with. Happy coding!

Monday, October 18, 2010

It's a follow-up work on last exercise "App Widget using Alarm Manager". As mentioned, the code haven't cancel the Alarm Service when all widgets removed from home screen. It's can be done in onDisabled() method of AppWidgetProvider.

First of all, we have to pass the value of alarmManager and pendingIntent to HelloWidgetProvider(which extends AppWidgetProvider) when created in HelloWidgetConfig(the configure activity).

In configOkButtonOnClickListener.onClick() of HelloWidgetConfig.java, add the code to pass the value of alarmManager and pendingIntent to HelloWidgetProvider()

Wednesday, October 13, 2010

AlarmManager class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running.

In this exercise, a scheduled alarm of 10 seconds will start a service, MyAlarmService.

If you want to create sub-folder in SD Card of Android Emulator, Android Debug Bridge(adb) can be used. Android Debug Bridge(adb) is a versatile tool lets you manage the state of an emulator instance or Android-powered device.

Thursday, October 7, 2010

android.app.Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use. Each service class must have a corresponding declaration in its package's AndroidManifest.xml. Services can be started with Context.startService() and Context.bindService(). (Ref: Service | Android Developers)

This exercise is a simple app with a dummy Local Service. Through the exercise, what can be noted are the life-cycle of a Service, how to link with Service with Start Service, Stop Service, Bind Service and Unbind Service, also the steps to implement the app with Service.

Create a New Android Application as normal, with the main activity AndroidService.

Tuesday, October 5, 2010

updatePeriodMillis in Widget Provider Information XML file define How often, in milliseconds, that this AppWidget wants to be updated. The AppWidget manager may place a limit on how often a AppWidget is updated.

- The updatePeriodMillis attribute defines how often the App Widget framework should request an update from the AppWidgetProvider by calling the onUpdate() method. The actual update is not guaranteed to occur exactly on time with this value. Refer "App Widget using Alarm Manager" to implement App Widget with higher rate.

- Updates requested with updatePeriodMillis will not be delivered more than once every 30 minutes.

- Only one updatePeriodMillis schedule will be managed for all instances of the App Widget. For example, if the update schedule is defined to be every two hours, and a second instance of the App Widget is added one hour after the first one, then they will both be updated on the period defined by the first one and the second update period will be ignored (they'll both be updated every two hours, not every hour).

Sunday, October 3, 2010

In the former article "A simple Home Screen App Widget to get Date/Time", we have a very minimal widget: simple self-described as a widget with update duration, then update the widget with current time. In the exercise, no configure activity have been defined; such that the update() method of the provider activity will be call when add the widget in home screen, and when update period is reached.

In this exercise, a configure activity wil be implemented; the onCreate() method of the configure activity will be called when the widget is added on home screen. And also, the onUpdate() method of the HelloWidgetProvider cass (extends AppWidgetProvider) will be modified to handle each appWidgetIds separately.

Modify onUpdate() of HelloWidgetProvider.java, and implemented updateAppWidget() method which will be called by onUpdate() and the new added configure activity.

onUpdate() includes a loop that iterates through each entry in appWidgetIds, which is an array of IDs that identify each App Widget created by this provider. In this way, if the user creates more than one instance of the App Widget, then they are all updated simultaneously.