From: Dirk Dougherty Date: Mon, 8 Feb 2010 18:22:43 +0000 (-0800) Subject: Add SampleSyncAdapter to SDK build and docs build. Add CubeLiveWallpaper to docs... X-Git-Tag: android-x86-2.2~59^2~6^2^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=658d86e5be4c776813797d9806fc80b7b7c9a7cc;p=android-x86%2Fdevelopment.git Add SampleSyncAdapter to SDK build and docs build. Add CubeLiveWallpaper to docs build. Change-Id: I149fb2aab91d0a2dfc4242a85118bf20dea97e42 --- diff --git a/build/sdk.atree b/build/sdk.atree index 845ddea8..f3bd0c67 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -72,7 +72,10 @@ sdk/files/devices.xml tools/lib/devices.xml # emacs support from sdk.git sdk/files/android.el tools/lib/android.el -# samples +# samples to include in the sdk samples package +# +# the list here should match the list of samples that we generate docs for, +# (see web_docs_sample_code_flags in frameworks/base/Android.mk) development/samples/source.properties samples/${PLATFORM_NAME}/source.properties development/apps/GestureBuilder samples/${PLATFORM_NAME}/GestureBuilder development/samples/BluetoothChat samples/${PLATFORM_NAME}/BluetoothChat @@ -80,6 +83,7 @@ development/samples/Home samples/${PLATFORM_NAME}/Home development/samples/LunarLander samples/${PLATFORM_NAME}/LunarLander development/samples/NotePad samples/${PLATFORM_NAME}/NotePad development/samples/ApiDemos samples/${PLATFORM_NAME}/ApiDemos +development/samples/SampleSyncAdapter samples/${PLATFORM_NAME}/SampleSyncAdapter development/samples/SkeletonApp samples/${PLATFORM_NAME}/SkeletonApp development/samples/Snake samples/${PLATFORM_NAME}/Snake development/samples/SoftKeyboard samples/${PLATFORM_NAME}/SoftKeyboard diff --git a/samples/CubeLiveWallpaper/AndroidManifest.xml b/samples/CubeLiveWallpaper/AndroidManifest.xml index b7bb8761..62153d4a 100644 --- a/samples/CubeLiveWallpaper/AndroidManifest.xml +++ b/samples/CubeLiveWallpaper/AndroidManifest.xml @@ -21,6 +21,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.livecubes"> + This sample demonstrates how to create a live wallpaper and bundle it in an +.apk that users can install on their devices.

+ +

In terms of implementation, a live wallpaper is very similar to a regular +Android service. The +only difference is the addition of a new method, onCreateEngine(), whose goal is to +create a +WallpaperService.Engine. The engine is responsible for +handling the lifecycle and drawing of a wallpaper. The system provides a surface +on which you can draw, just like you would with a SurfaceView. +The wallpapers you create can respond to touch events on the screen and +have access to all the facilities of the platform: SGL (2D drawing), OpenGL (3D +drawing), GPS, accelerometers, network access, and so on.

+ +

The examples in this application show how to set up a wallpaper service that +creates a WallpaperService.Engine to manage the service lifecycle, +render the wallpaper, handle touch events, and so on. The examples also show how +a wallpaper should stop drawing when its visibility changes, for example, when +the user launches an application that covers the home screen. Drawing only when +visible is an important implementation guideline for live wallpapers because it +minimizes the wallpaper's impact on system performance and battery life. +

+ +

The application includes two wallpaper services and a wallpaper settings +activity:

+ +

    +
  • +CubeWallpaper1 — a wallpaper service that draws and animates a +wire-frame cube to a Canvas. +
  • +
  • CubeWallpaper2 +— a wallpaper service that draws and animates a +wire-frame shape to a Canvas. The shape is set by the user, by means +of the cube2.CubeWallpaper2Settings settings activity (see below). The +wallpaper service implements a listener callback method that captures the user's +wallpaper shape preference.
  • +
  • CubeWallpaper2Settings +— a wallpaper service that draws and +animates a wire-frame shape to a Canvas. The shape is set by the +user through a simple settings activity, +cube2.CubeWallpaper2Settings, also included in the app. The +wallpaper service implements a listener callback method that captures the user's +wallpaper shape preference.
  • +
+ +

If you are developing a live wallpaper, remember that the feature is +supported only on Android 2.1 (API level 7) and higher versions of the platform. +To ensure that your application can only be installed on devices that support +live wallpapers, remember to add the following to the application's manifest +before publishing to Android Market:

+ +
    +
  • <uses-sdk android:minSdkVersion="7" />, which indicates +to Android Market and the platform that your application requires Android 2.1 or +higher. For more information, see the API Levels +and the documentation for the +<uses-sdk> +element.
  • +
  • <uses-feature android:name="android.software.live_wallpaper" />, +which tells Android Market that your application includes a live wallpaper. +Android Market uses this feature as a filter, when presenting users lists of +available applications. When you declaring this feature, Android Market +displays your application only to users whose devices support live wallpapers, +while hiding it from other devices on which it would not be able to run. For +more information, see the documentation for the +<uses-feature> +element.
  • +
+ +

For more information about live wallpapers, see the +Live Wallpapers article.

+ +Screenshot 1 +Screenshot 3 diff --git a/samples/SampleSyncAdapter/_index.html b/samples/SampleSyncAdapter/_index.html index b0fbd4aa..4191ba50 100644 --- a/samples/SampleSyncAdapter/_index.html +++ b/samples/SampleSyncAdapter/_index.html @@ -1,26 +1,37 @@ -

A sample that demonstrates how an application can communicate with cloud-based services and synchronize their data with data stored locally in a content provider. -The sample uses two related parts of the Android framework — the account manager and the synchronization manager (through a sync adapter).

+

This sample demonstrates how an application can communicate with a +cloud-based service and synchronize its data with data stored locally in a +content provider. The sample uses two related parts of the Android framework +— the account manager and the synchronization manager (through a sync +adapter).

-

The account manager allows sharing of credentials across multiple applications and services. -Users enter the credentials for each account only once — applications with the USE_CREDENTIALS permission can then query the account manager - to obtain an auth token for the account.The authenticator (a pluggable component of account manager) requests credentials from the user, validates them - with an authentication server running in the cloud, and then stores them to the AccountManager. -This sample demonstrates how to write an authenticator for your -service by extending the new AbstractAccountAuthenticator abstract class. -

+

The account +manager allows sharing of credentials across multiple applications and +services. Users enter the credentials for each account only once — +applications with the USE_CREDENTIALS permission can then query the +account manager to obtain an auth token for the account. An authenticator (a +pluggable component of account manager) requests credentials from the user, +validates them with an authentication server running in the cloud, and then +stores them to the account manager. This sample demonstrates how to write an +authenticator for your service by extending the new +AbstractAccountAuthenticator abstract class.

-

The sync adapter (essential to the synchronization service) declares the account type and ContentProvider authority to the sync manager. -This sample demosntrates how to write your own sync adapters by extending the AbstractThreadedSyncAdapter -abstract class and implementing the onPerformSync() method that gets called whenever the sync manager issues a sync operation for that sync adapter. -

+

The sync adapter (essential to the synchronization service) declares the +account type and ContentProvider authority to the sync manager. This sample +demosntrates how to write your own sync adapters by extending the +AbstractThreadedSyncAdapter abstract class and implementing the +onPerformSync() method, which gets called whenever the sync manager +issues a sync operation for that sync adapter.

-

The service for this sample application is running at:
-http://samplesyncadapter.appspot.com/users -

+

The cloud-based service for this sample application is running at:

+

http://samplesyncadapter.appspot.com/users

-

When you install this sample application, a new syncable "SampleSyncAdapter" account will be added to your phone's account manager. -You can go to "Settings | Accounts & sync" to view the accounts that are stored in the account manager and to change their sync settings.

+

When you install this sample application, a new syncable "SampleSyncAdapter" +account will be added to your phone's account manager. You can go to "Settings | +Accounts & Sync" to view the account and change its sync settings.

Screenshot 1 Screenshot 2 -Screenshot 3 \ No newline at end of file +Screenshot 3