Aug 18

Android Wear 2.0 for China – Developer Preview

Posted by Hoi Lam, Developer Advocate

Today at Google
Developer Day China, we are happy to announce a developer preview
of Android Wear 2.0 for developers creating apps for China. Android Wear 2.0 is
the biggest update since our partners launched their first devices in China last
year.

We’re making a Developer Preview available today and plan to release additional
updates in the coming months. Please send us your feedback by filing bugs or posting in our Android Wear
Developers community.

Developing for the Chinese Market

With Android Wear 2.0, apps can access the internet directly on Android Wear
devices. As a result, for the majority of apps, having a companion phone
application is no longer necessary. This means that most developers creating
apps for Android Wear 2.0 may no longer need to import the Google Play services
library.

There are two situations where developers will need to import Google Play
services for China:

  • Apps that require direct interaction with the paired mobile
    device
    – some experiences require Android Wear to connect directly to a
    paired phone. In this case, the Data
    Layer API introduced in Android Wear 1.0 will continue to function.

  • New FusedLocationProvider
    for China
    – we have added location detection to the SDK for Chinese
    developers. With the user’s permission, your app can receive location updates
    via the FusedLocationProvider.

You can find more details about how to import the China compatible version of
Google Play services library here.

Product testing for Android Wear 2.0 for China

The Android Wear 2.0 Developer Preview includes an updated SDK with tools, and
system images for testing using the Huawei Watch.

To get started, follow these steps:

  • Update to Android Studio v2.1.1 or later
  • Visit the Android Wear 2.0
    Developer Preview site for downloads and documentation

  • Download
    the device system images

  • Test your app with your supported device

Give us feedback

We will update this developer preview over the next few months based on your
feedback. The sooner we hear from you, the more we can include in the final
release, so don’t be shy!

Android Wear 2.0 中国版 – 开发者预览版

编辑: 林海泉, Android Wear 开发平台负责人

今天在上海举办的Google
开发者大会上,我们正式宣布了一款专门针对中国市场的Android Wear 2.0 开发者预览版。Android Wear
2.0系统,将是自我们的合作伙伴首次发布手表产品以来最重大的更新。

开发者预览版已于今日正式上线。与此同时,我们也计划在未来的几个月内持续进行更新。请您将您遇到的问题在此提交反馈,或者在我们的Android
Wear开发者论坛发表意见。

为中国市场开发应用

在Android Wear 2.0系统中,应用可以由Android
Wear手表直接连接至互联网。因此,对于大多数应用来说,手机端的伴侣应用也就变得不再必要。这也意味着,多数为Android Wear
2.0开发应用的开发者将不再需要引用Google Play services客户端库。

目前,在两个情况下开发者仍然需要引入Google Play Services客户端库来为中国市场开发应用:

  • 需要与手机直接进行通信的应用 – 有一些用例需要Android
    Wear手表与已配对手机直接连接。在这种情况下,Android Wear 1.0中引入的Data
    Layer API仍然可以继续使用。

  • 使用 FusedLocationProvider
    - 我们在最新的中国版SDK中加入了定位的支持。在用户的许可下,您的应用可以通过FusedLocationProvider来接收定位更新。

您可以在这里找到关于如何引入与中国版兼容的Google
Play service的更多信息。

Android Wear 2.0 中国版产品测试

Android Wear 2.0 开发者预览版包括最新的SDK套件,手表测试系统镜像(基于华为手表)。

情按照以下步骤进行测试:

  • 更新到Android Studio至v2.1.1以上版本
  • 访问 Android Wear
    2.0 开发者预览版,那里的文件下载与文档下载部分

  • 下载手表系统镜像
  • 在手表上测试您的应用

开发反馈

我们会根据您的反馈在未来的几个月中更新开发者预览版。您给我们的反馈越早,我们将会在最终的发布版本中包含更多针对您的反馈的解决方案。敬请期待!


Android Developers Blog

Aug 17

Android Wear 2.0 Developer Preview 4: Authentication, In-App Billing, and more

Posted by Hoi Lam, Developer
Advocate

A key part of Android Wear 2.0 is letting
watch apps work as standalone apps, so users can respond to messages, track
their fitness, and use their favorite apps, even when their phone isn’t around.
Developer Preview 4 includes a number of new APIs that will help you build more
powerful standalone apps.

Seamless authentication

To make authentication a seamless experience for both Android phone and iPhone
users, we have created new APIs for OAuth
and added support for one-click Google Sign-in. With the OAuth API for
Android Wear, users can tap a button on the watch that opens an authentication
screen on the phone. Your watch app can then authenticate with your server side
APIs directly. With Google Sign-In, it’s even easier. All the user needs to do
is select which account they want to authenticate with and they are done.

In-app billing

In addition to paid apps, we have added in-app
billing support, to give you another way to monetize your Android Wear app
or watch face. Users can authorize purchases quickly and easily on the watch
through a 4-digit Google Account PIN. Whether it’s new levels in a game or new
styles on a watch face, if you can build it, users can buy it.

Cross-device promotion

What if your watch app doesn’t work standalone? Or what if it offers a better
user experience when both the watch and phone apps are installed? We’ve been
listening carefully to your feedback, and we’ve added two
new APIs (PlayStoreAvailability and RemoteIntent)
to help you navigate users to the Play Store on a paired device so they can
more easily install your app. Developers can also open custom URLs on the phone
from the watch via the new RemoteIntent API; no phone app or data
layer is required.

// Check Play Store is available
int playStoreAvailabilityOnPhone =
    PlayStoreAvailability.getPlayStoreAvailabilityOnPhone(getApplicationContext());

if (playStoreAvailabilityOnPhone == PlayStoreAvailability.PLAY_STORE_ON_PHONE_AVAILABLE) {
    // To launch a web URL, setData to Uri.parse("https://g.co/wearpreview")
    Intent intent =
        new Intent(Intent.ACTION_VIEW)
            .addCategory(Intent.CATEGORY_BROWSABLE)
            .setData(Uri.parse("market://details?id=com.google.android.wearable.app"));
    // mResultReceiver is optional; it can be null.
    RemoteIntent.startRemoteActivity(this, intent, mResultReceiver);
}

Swipe-to-dismiss is back

Many of you have given us the feedback that the swipe-to-dismiss gesture from
Android Wear 1.0 is an intuitive time-saver. We agree, and have reverted back to
the previous behavior with this developer preview release. To support
swipe-to-dismiss in this release, we’ve made the following platform and API
changes:

  • Activities now automatically support swipe-to-dismiss.
    Swiping an activity from left to right will result in it being dismissed and the
    app will navigate down the back stack.

  • New Fragment and View support. Developers can wrap the
    containing views of a Fragment or Views in general in the new
    SwipeDismissFrameLayout to implement custom actions such as going
    down the back stack when the user swipes rather than exiting the activity.

  • Hardware button now maps to “power” instead of “back” which
    means it can no longer be intercepted by apps.

Additional details are available under the behavior
changes section of the Android Wear Preview site.

Compatibility with Android Wear 1.0 apps

Android Wear apps packaged using the legacy embedded app mechanism can now be
delivered to Android Wear 2.0 watches. When a user installs a phone app that
also contains an embedded Android Wear app, the user will be prompted to install
the embedded app via a notification. If they choose not to install the embedded
app at that moment, they can find it in the Play Store on Android Wear under a
special section called “Apps you’ve used”.

Despite support for the existing mechanism, there are significant benefits for
apps that transition to the multi-APK
delivery mechanism. Multi-APK allows the app to be searchable in the Play
Store on Android Wear, to be eligible for merchandising on the homepage, and to
be remotely installed from the web to the watch. As a result, we strongly
recommend that developers move to multi-APK.

More additions in Developer Preview 4

  • Action
    and Navigation Drawers: An enhancement to peeking behavior
    allows the user to take action without scrolling all the way to the top or
    bottom of a list. Developers can further fine-tune drawer peeking behavior
    through new APIs, such as setShouldPeekOnScrollDown for the action
    drawer.

  • WearableRecyclerView:
    The curved layout is now opt-in, and with this, the WearableRecyclerView is now
    a drop-in replacement for RecyclerView.

  • Burn-in
    protection icon for complications: Complication data providers can now
    provide icons for use on screens susceptible to burn-in. These burn-in-safe
    icons are normally the outline of the icon in interactive mode. Previously,
    watch faces may have chosen not to display the icon at all in ambient mode to
    prevent screen burn-in.

Feedback welcome!

Thanks for all your terrific feedback on Android Wear 2.0. Check out g.co/wearpreview for the latest builds and
documentation, keep the feedback coming by filing bugs or posting in our Android Wear
Developers community, and stay tuned for Android Wear Developer Preview 5!


Android Developers Blog

Aug 16

Android Wear 2.0 Developer Preview 4: Authentication, In-App Billing, and more

Posted by Hoi Lam, Developer
Advocate

A key part of Android Wear 2.0 is letting
watch apps work as standalone apps, so users can respond to messages, track
their fitness, and use their favorite apps, even when their phone isn’t around.
Developer Preview 4 includes a number of new APIs that will help you build more
powerful standalone apps.

Seamless authentication

To make authentication a seamless experience for both Android phone and iPhone
users, we have created new APIs for OAuth
and added support for one-click Google Sign-in. With the OAuth API for
Android Wear, users can tap a button on the watch that opens an authentication
screen on the phone. Your watch app can then authenticate with your server side
APIs directly. With Google Sign-In, it’s even easier. All the user needs to do
is select which account they want to authenticate with and they are done.

In-app billing

In addition to paid apps, we have added in-app
billing support, to give you another way to monetize your Android Wear app
or watch face. Users can authorize purchases quickly and easily on the watch
through a 4-digit Google Account PIN. Whether it’s new levels in a game or new
styles on a watch face, if you can build it, users can buy it.

Cross-device promotion

What if your watch app doesn’t work standalone? Or what if it offers a better
user experience when both the watch and phone apps are installed? We’ve been
listening carefully to your feedback, and we’ve added two
new APIs (PlayStoreAvailability and RemoteIntent)
to help you navigate users to the Play Store on a paired device so they can
more easily install your app. Developers can also open custom URLs on the phone
from the watch via the new RemoteIntent API; no phone app or data
layer is required.

// Check Play Store is available
int playStoreAvailabilityOnPhone =
    PlayStoreAvailability.getPlayStoreAvailabilityOnPhone(getApplicationContext());

if (playStoreAvailabilityOnPhone == PlayStoreAvailability.PLAY_STORE_ON_PHONE_AVAILABLE) {
    // To launch a web URL, setData to Uri.parse("https://g.co/wearpreview")
    Intent intent =
        new Intent(Intent.ACTION_VIEW)
            .addCategory(Intent.CATEGORY_BROWSABLE)
            .setData(Uri.parse("market://details?id=com.google.android.wearable.app"));
    // mResultReceiver is optional; it can be null.
    RemoteIntent.startRemoteActivity(this, intent, mResultReceiver);
}

Swipe-to-dismiss is back

Many of you have given us the feedback that the swipe-to-dismiss gesture from
Android Wear 1.0 is an intuitive time-saver. We agree, and have reverted back to
the previous behavior with this developer preview release. To support
swipe-to-dismiss in this release, we’ve made the following platform and API
changes:

  • Activities now automatically support swipe-to-dismiss.
    Swiping an activity from left to right will result in it being dismissed and the
    app will navigate down the back stack.

  • New Fragment and View support. Developers can wrap the
    containing views of a Fragment or Views in general in the new
    SwipeDismissFrameLayout to implement custom actions such as going
    down the back stack when the user swipes rather than exiting the activity.

  • Hardware button now maps to “power” instead of “back” which
    means it can no longer be intercepted by apps.

Additional details are available under the behavior
changes section of the Android Wear Preview site.

Compatibility with Android Wear 1.0 apps

Android Wear apps packaged using the legacy embedded app mechanism can now be
delivered to Android Wear 2.0 watches. When a user installs a phone app that
also contains an embedded Android Wear app, the user will be prompted to install
the embedded app via a notification. If they choose not to install the embedded
app at that moment, they can find it in the Play Store on Android Wear under a
special section called “Apps you’ve used”.

Despite support for the existing mechanism, there are significant benefits for
apps that transition to the multi-APK
delivery mechanism. Multi-APK allows the app to be searchable in the Play
Store on Android Wear, to be eligible for merchandising on the homepage, and to
be remotely installed from the web to the watch. As a result, we strongly
recommend that developers move to multi-APK.

More additions in Developer Preview 4

  • Action
    and Navigation Drawers: An enhancement to peeking behavior
    allows the user to take action without scrolling all the way to the top or
    bottom of a list. Developers can further fine-tune drawer peeking behavior
    through new APIs, such as setShouldPeekOnScrollDown for the action
    drawer.

  • WearableRecyclerView:
    The curved layout is now opt-in, and with this, the WearableRecyclerView is now
    a drop-in replacement for RecyclerView.

  • Burn-in
    protection icon for complications: Complication data providers can now
    provide icons for use on screens susceptible to burn-in. These burn-in-safe
    icons are normally the outline of the icon in interactive mode. Previously,
    watch faces may have chosen not to display the icon at all in ambient mode to
    prevent screen burn-in.

Feedback welcome!

Thanks for all your terrific feedback on Android Wear 2.0. Check out g.co/wearpreview for the latest builds and
documentation, keep the feedback coming by filing bugs or posting in our Android Wear
Developers community, and stay tuned for Android Wear Developer Preview 5!


Android Developers Blog

Aug 16

Develop a sweet spot for Marshmallow: Official Android 6.0 SDK & Final M Preview

By Jamal Eason, Product Manager, Android

Android 6.0 Marshmallow

Whether you like them straight out of the bag, roasted to a golden brown exterior with a molten center, or in fluff form, who doesn’t like marshmallows? We definitely like them! Since the launch of the M Developer Preview at Google I/O in May, we’ve enjoyed all of your participation and feedback. Today with the final Developer Preview update, we’re introducing the official Android 6.0 SDK and opening Google Play for publishing your apps that target the new API level 23 in Android Marshmallow.

Get your apps ready for Android Marshmallow

The final Android 6.0 SDK is now available to download via the SDK Manager in Android Studio. With the Android 6.0 SDK you have access to the final Android APIs and the latest build tools so that you can target API 23. Once you have downloaded the Android 6.0 SDK into Android Studio, update your app project compileSdkVersion to 23 and you are ready to test your app with the new platform. You can also update your app to targetSdkVersion to 23 test out API 23 specific features like auto-backup and app permissions.

Along with the Android 6.0 SDK, we also updated the Android Support Library to v23. The new Android Support library makes it easier to integrate many of the new platform APIs, such as permissions and fingerprint support, in a backwards-compatible manner. This release contains a number of new support libraries including: customtabs, percent, recommendation, preference-v7, preference-v14, and preference-leanback-v17.

Check your App Permissions

Along with the new platform features like fingerprint support and Doze power saving mode, Android Marshmallow features a new permissions model that streamlines the app install and update process. To give users this flexibility and to make sure your app behaves as expected when an Android Marshmallow user disables a specific permission, it’s important that you update your app to target API 23, and test the app thoroughly with Android Marshmallow users.

How to Get the Update

The Android emulator system images and developer preview system images have been updated for supported Nexus devices (Nexus 5, Nexus 6, Nexus 9 & Nexus Player) to help with your testing. You can download the device system images from the developer preview site. Also, similar to the previous developer update, supported Nexus devices will receive an Over-the-Air (OTA) update over the next couple days.

Although the Android 6.0 SDK is final, the devices system images are still developer preview versions. The preview images are near final but they are not intended for consumer use. Remember that when Android 6.0 Marshmallow launches to the public later this fall, you’ll need to manually re-flash your device to a factory image to continue to receive consumer OTA updates for your Nexus device.

What is New

Compared to the previous developer preview update, you will find this final API update fairly incremental. You can check out all the API differences here, but a few of the changes since the last developer update include:

  • Android Platform Change:

    • Final Permissions User Interface — we updated the permissions user interface and enhanced some of the permissions behavior.
  • API Change:

    • Updates to the Fingerprint API — which enables better error reporting, better fingerprint enrollment experience, plus enumeration support for greater reliability.

Upload your Android Marshmallow apps to Google Play

Google Play is now ready to accept your API 23 apps via the Google Play Developer Console on all release channels (Alpha, Beta & Production). At the consumer launch this fall, the Google Play store will also be updated so that the app install and update process supports the new permissions model for apps using API 23.

To make sure that your updated app runs well on Android Marshmallow and older versions, we recommend that you use Google Play’s newly improved beta testing feature to get early feedback, then do a staged rollout as you release the new version to all users.


Android Developers Blog

Jul 26

Final preview update, official Android P coming soon!


Posted By Dave Burke, VP of Engineering

Android P is almost here! As we put the finishing touches on the new platform, today we’re bringing you Android P Beta 4.

Beta 4 is the last preview milestone before we launch the official Android P platform later this summer. Take this opportunity to test your apps and publish updates, to make sure you offer a great experience for users transitioning to Android P!

What’s in this update?

Today’s Beta 4 update includes a release candidate build with final system behaviors and the official Android P APIs (API level 28), available since Beta 2. It includes everything you need to wrap up your testing in time for the upcoming official Android P release.

Get your apps ready for Android P

With the consumer launch coming soon, it’s important to test your app for compatibility with Android P. Just install your current app from Google Play on an Android P Beta device or emulator. As you work through the flows, make sure your app runs and looks great, and that it handles the Android P behavior changes properly.

Also watch for uses of non-SDK interfaces in your app. Android P restricts access to selected non-SDK interfaces, so you should reduce your reliance on them. See our recent post for details..

After you’ve made any necessary updates, we recommend publishing to Google Play right away without changing the app’s platform targeting. This lets you ensure a great experience for Android P users while you work on enhancing your app with Android P APIs and targeting.

Enhance your app with Android P features and APIs

When you’re ready, dive into Android P and learn about the new features and APIs that you can use in your apps, like multi-camera support, display cutout, enhanced notifications, ImageDecoder, TextClassifier, and others.

To build with the new APIs, just download the official API 28 SDK and tools into Android Studio 3.1, or use the latest version of Android Studio 3.2. Then update your project’s compileSdkVersion and targetSdkVersion to API 28. When you change your targeting, make sure your app supports all of the applicable behavior changes.

As soon as you’re ready, publish your APK updates that are compiled against, or optionally targeting, API 28. A common strategy is to use Google Play’s beta testing feature to get early feedback from a small group of users and then do a staged rollout to production.

Visit the Developer Preview site for details and documentation. Also check out this video and the Google I/O Android playlist for more on what’s new in Android P for developers.

How do I get Beta 4?

It’s easy – you can get Android P Beta 4 on Pixel devices by enrolling here. If you’re already enrolled in our Android Beta program, you’ll automatically get the Beta 4 update soon. As always, downloadable system images for Pixel devices are also available. Partners who are participating in the Android P Beta program will also be updating their devices to Beta 4 over the coming weeks.

What’s next?

Stay tuned for the official Android P launch coming soon! You can continue to share your feedback or requests in the meantime, and feel free to use our hotlists for platform issues, app compatibility issues, and third-party SDK issues.

Thanks for your feedback so far, and thank you to everyone who participated in our recent Reddit AMA on r/androiddev!


Android Developers Blog

Jul 19

Final update to Android 7.1 Developer Preview

Posted by Dave Burke, VP of Engineering

Today we’re rolling out an update to the Android 7.1 Developer Preview — the
last before we release the final Android 7.1.1 platform to the ecosystem.
Android 7.1.1 includes the developer features already available on Pixel and
Pixel XL devices and adds optimizations and bug fixes on top of the base Android
7.1 platform. With Developer Preview 2, you can make sure your apps are ready
for Android 7.1.1 and the consumers that will soon be running it on their
devices.

As highlighted
in October, we’re also expanding the range of devices that can receive this
Developer Preview update to Nexus 5X, Nexus 6P, Nexus 9, and Pixel C.

If you have a supported device that’s enrolled in the Android Beta Program, you’ll receive an
update to Developer Preview 2 over the coming week. If you haven’t enrolled your
device yet, just visit the site to
enroll your device and get the update.

In early December, we’ll roll out Android 7.1.1 to the full lineup of supported
devices as well as Pixel and Pixel XL devices.

What’s in this update?

Developer Preview 2 is a release candidate for Android 7.1.1 that you can use to
complete your app development and testing in preparation for the upcoming final
release. In includes near-final system behaviors and UI, along with the latest
bug fixes and optimizations across the system and Google apps.

It also includes the developer features and APIs (API level 25) already
introduced in Developer Preview 1. If you haven’t explored the developer
features, you’ll want to take a look at app shortcuts,
round
icon resources, and image keyboard
support, among others — you can see the full list of
developer features here.

With Developer Preview 2, we’re also updating the SDK build and platform tools
in Android Studio, the Android 7.1.1 platform, and the API Level 25 emulator
system images. The latest version of the support library (25.0.1)
is also available for you to add
image keyboard support, bottom
navigation, and other features for devices running API Level 25 or earlier.

For details on API Level 25 check out the API
diffs and the updated API
reference on the developer preview
site.

Get your apps ready for Android 7.1

Now is the time to optimize your apps to look their best on Android 7.1.1. To
get started, update to Android
Studio 2.2.2 and then download the API Level 25 platform, emulator system
images, and tools through the SDK Manager in Android Studio.

After installing the API Level 25 SDK, you can update your project’s
compileSdkVersion to 25 to build and test against the new APIs. If you’re doing
compatibility testing, we recommend updating your app’s targetSdkVersion to 25
to test your app with compatibility behaviors disabled. For details on how to
set up your app with the API Level 25 SDK, see Set
up the Preview.

If you’re adding app shortcuts or circular launcher icons to your app, you can
use Android Studio’s built-in Image Asset Studio to quickly help you create
icons of different sizes that meet the material
design guidelines. You can test your round icons on the Google APIs emulator
for API Level 25, which includes support for round icons and the new Google
Pixel Launcher.


Android Studio and the Google APIs emulator let you quickly create and test
your round icon assets.

If you’re adding image keyboard support, you can use the Messenger and Google
Keyboard apps included in the preview system images for testing as they include
support for this new API.

Scale your tests using Firebase Test Lab for Android

To help scale your testing, make sure to take advantage of Firebase
Test Lab for Android and run your tests in the cloud at no charge during the
preview period on all virtual devices including the Developer Preview 2 (API
25). You can use the automated crawler (Robo Test) to
test your app without having to write any test scripts, or you can upload your
own instrumentation (e.g. Espresso) tests. You can upload your tests here.

Publish your apps to alpha, beta or production channels in Google
Play

After you’ve finished final testing, you can publish your updates compiled
against, and optionally targeting, API 25 to Google Play. You can publish to
your alpha, beta,
or even production channels in the Google Play Developer Console. In this way,
push your app updates to users whose devices are running Android 7.1, such as
Pixel and Android Beta devices.

Get Developer Preview 2 on Your Eligible Device

If you have an eligible device that’s already enrolled in the Android Beta Program, the device will get
the Developer Preview 2 update over the coming week. No action is needed on your
part. If you aren’t yet enrolled in program, the easiest way to get started is
by visiting android.com/beta and opt-in
your eligible Android phone or tablet — you’ll soon receive this preview update
over-the-air. As always, you can also download and flash
this update manually.

As mentioned above, this Developer Preview update is available for Nexus 5X,
Nexus 6P, Nexus 9, and Pixel C devices.

We’re expecting to launch the final release of the Android 7.1.1 in just a few
weeks Starting in December, we’ll roll out Android 7.1.1 to the full lineup of
supported preview devices, as well as the recently launched Pixel and Pixel XL
devices. At that time, we’ll also push the sources to AOSP, so our device
manufacturer partners can bring this new platform update to consumers on their
devices.

Meanwhile, we continue to welcome your feedback in the Developer
Preview issue tracker, N
Preview Developer community, or Android Beta
community as we work towards the final consumer release in December!


Android Developers Blog

Jun 27

Test on Android 7.1 Developer Preview in Firebase Test Lab

By Ahmed Mounir Gad, Product Manager, Firebase Test Lab

To deliver the best user experience right out of the gate, Firebase Test Lab for Android allows you to test your apps and ensure their compatibility with multiple device configurations, across OS versions, screen orientations, and locales. With a single click, you can run your tests on hundreds of device configurations in Google Cloud and receive your results quickly.

Today, we’re excited to announce the availability of the Android 7.1 Developer Preview on Firebase Test Lab virtual devices. In addition to testing the Android 7.1 Developer Preview on your physical Android Device with the Android Beta program, or on your local Android Emulator, you can use the Firebase Test Lab to scale your app testing to hundreds of Android virtual devices.

You can also use Firebase Test Lab to perform your own testing. If you don’t have any test scripts, Robo test is ideal for doing your basic compatibility testing on the new platform. It crawls your app in an attempt to find crashes. You can also use the Espresso Test Recorder in Android Studio to record your own instrumentation tests without writing any code.

From now until the end of December (12/31/2016), Firebase Test Lab will be offered at no charge on the Firebase Blaze plan for all virtual devices, to help you ensure the compatibility of your app with the Android 7.1 Developer Preview release, as well as with other Android releases.

Prepare your app for API level 25, then go to the Firebase Test Lab console to run your first test.

Happy testing!

Robo tests uncovering a crash on Android 7.1 Developer Preview for the Flood-It! app.


Android Developers Blog

Jun 12

Wear OS developer preview reenabling alarms and jobs for background apps


Posted by Hoi Lam, Lead Developer Advocate, Wear OS by Google

From the outset of the Wear OS by Google developer preview, battery life has been a major focus area. When we talked to the developer community, the update that attracted the most feedback was the disabling of alarms and jobs for background apps. After listening to developer feedback and reviewing the battery statistics, we are reversing this change. This should be reflected in all connected Wear OS preview devices, so there is no need to reflash your device.

App Standby Buckets

The decision came as we reviewed the feedback and saw that a strict on/off setting prevents reasonable usage and promotes anti-patterns. Going forward, we plan to leverage the App Standby Buckets feature in Android P to fine-tune a suitable setting for Wear OS devices. The exact setting for alarms and jobs for background apps is still being iterated on. Developers are advised to follow the best practices to make sure their apps behave well, whichever bucket the apps are in.

Input and data privacy in background apps

Another area that developers should pay attention to is the strengthening of input and data privacy for background apps in Android P. Depending on an app’s requirements, developers may need to use a foreground service to enable access to the device sensor throughout the day.

Please give us your feedback

We expect to provide more updates to this preview before the final production release. Please submit any bugs you find via the Wear OS by Google issue tracker. The earlier you submit them, the higher the likelihood that we can include the fixes in the final release.


Android Developers Blog

Jun 09

Porting Your Android Wear Developer Preview Code to the Latest Support Library

Today’s post on #AndroidWear is from +Wayne Piekarski.

Now that the full Android Wear SDK is available, it’s time to port your existing wearable-enabled notification code from the Developer Preview. In the process, you’ll switch to using the latest Android support library, and there are some small API changes that will require you to update your code. This article will show you how to update my previous code samples that were released earlier for stacks and pages, which you can use to guide the conversion of your own code as well.

To get started with an existing project in Android Studio, you should update to the 0.8 or later release. You also need to make sure you’ve downloaded the Google Support Library version 20 or later from the SDK Manager. Since this is only a notification-based example, there’s no need to download the full Android Wear SDK, which is only needed if you want to create an APK to run on the wearable device.

Unix diff output is used to show the necessary changes in an easy to understand way. Do not copy the + or – symbols at the start of each line, and ignore the lines starting with @@ which are used to indicate the line number that changed. For the curious, I used the following command to generate the diff output from the last commit in my GIT repository (the -U1 shows one line of context to keep the output simple):

git show HEAD -U1

Gradle changes

To add the new support-v4 library, you need to edit your build.gradle file like so:

@@ -24,2 +24,3 @@ dependencies {
     compile 'com.android.support:appcompat-v7:19.+'
+    compile 'com.android.support:support-v4:20.0+'
 }

Make sure you remove the wearable-preview-support.jar that was provided with the Developer Preview from your libs directory and build.gradle file, since these features are now in the standard support library.

Package imports

Since the APIs and package names have changed, the import statements at the top of MainActivity.java need to be adjusted like this:

@@ -7,3 +7,2 @@ import android.view.MenuItem;
-import android.support.v4.app.NotificationCompat;
 import android.app.Notification;
@@ -13,4 +12,9 @@ import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.preview.support.v4.app.NotificationManagerCompat;
-import android.preview.support.wearable.notifications.WearableNotifications;
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
+
+// Extra dependencies needed for the pages example
+import java.util.ArrayList;
+import java.util.List;
+import android.support.v4.app.NotificationCompat.BigTextStyle;

Stacking notifications

Since the preview SDK, we have simplified how notifications are implemented. The existing NotificationCompat.Builder() was extended to support groups directly, instead of a separate WearableNotifications class. The steps are a lot simpler, as can be seen with the following changes to showStackNotifications():

@@ -63,3 +67,3 @@ public class MainActivity extends ActionBarActivity {
         // Group notification that will be visible on the phone
-    NotificationCompat.Builder builderG = new NotificationCompat.Builder(this)
+    Notification summaryNotification = new NotificationCompat.Builder(this)
             .setContentTitle("2 Pet Notifications")
@@ -67,5 +71,5 @@ public class MainActivity extends ActionBarActivity {
             .setSmallIcon(R.drawable.ic_launcher)
-                .setLargeIcon(bitmapMila);
-    Notification summaryNotification = new WearableNotifications.Builder(builderG)
-            .setGroup(GROUP_KEY_MESSAGES, WearableNotifications.GROUP_ORDER_SUMMARY)
+                .setLargeIcon(bitmapMila)
+            .setGroup(GROUP_KEY_MESSAGES)
+            .setGroupSummary(true)
             .build();
@@ -76,3 +80,3 @@ public class MainActivity extends ActionBarActivity {
             PendingIntent.getActivity(this, notificationId+1, viewIntent1, 0);
-    NotificationCompat.Builder builder1 = new NotificationCompat.Builder(this)
+    Notification notification1 = new NotificationCompat.Builder(this)
             .addAction(R.drawable.ic_action_done, "Treat Fed", viewPendingIntent1)
@@ -81,4 +85,3 @@ public class MainActivity extends ActionBarActivity {
                     + "Can we have steak?")
-                .setSmallIcon(R.drawable.ic_launcher);
-    Notification notification1 = new WearableNotifications.Builder(builder1)
+            .setSmallIcon(R.drawable.ic_launcher)
             .setGroup(GROUP_KEY_MESSAGES)
@@ -89,3 +92,3 @@ public class MainActivity extends ActionBarActivity {
             PendingIntent.getActivity(this, notificationId+2, viewIntent2, 0);
-    NotificationCompat.Builder builder2 = new NotificationCompat.Builder(this)
+    Notification notification2 = new NotificationCompat.Builder(this)
             .addAction(R.drawable.ic_action_done, "Water Filled", viewPendingIntent2)
@@ -93,4 +96,3 @@ public class MainActivity extends ActionBarActivity {
             .setContentText("Can you refill our water bowl?")
-            .setSmallIcon(R.drawable.ic_launcher);
-        Notification notification2 = new WearableNotifications.Builder(builder2)
+            .setSmallIcon(R.drawable.ic_launcher)
             .setGroup(GROUP_KEY_MESSAGES)

Page notifications

Page notifications have also changed to use a WearableExtender() class instead of the WearableNotifications class, as can be seen here in showPageNotifications():

@@ -151,3 +153,3 @@ public class MainActivity extends ActionBarActivity {
             PendingIntent.getActivity(this, notificationId+1, viewIntent1, 0);
-    NotificationCompat.Builder builder1 = new NotificationCompat.Builder(this)
+    Notification notification1 = new NotificationCompat.Builder(this)
             .addAction(R.drawable.ic_action_done, "Returned", viewPendingIntent1)
@@ -155,5 +157,4 @@ public class MainActivity extends ActionBarActivity {
             .setContentText("You have " + numOverdue + " books due at the library")
-            .setSmallIcon(R.drawable.ic_launcher);
-    Notification notification1 = new WearableNotifications.Builder(builder1)
-            .addPages(extras)
+                .setSmallIcon(R.drawable.ic_launcher)
+            .extend(new NotificationCompat.WearableExtender().addPages(extras))
             .build();

Conclusion

If you want to download the final source code of showStackNotifications() and showPageNotifications(), you can download the MainActivity.java file. You can build this file easily by creating a new project in Android Studio, adding the support library, and then copying in this MainActivity.java.

As you can see, porting this previous code over to the latest Android Wear SDK is really easy! It should take you hardly any time at all to get your experimental applications ported over and ready for publishing on the Google Play!

Join the discussion on
+Android Developers


Android Developers Blog

Jun 07

Now available: Android 7.1 Developer Preview

Posted by Dave Burke, VP of Engineering

A couple of weeks ago we announced that a developer preview of Android 7.1 Nougat was on the way. You can get started with this new release today by downloading the SDK and tools. To get the 7.1 release on your eligible device, enroll your device in the Android Beta program. If your device is already enrolled, you’ll receive the update automatically.

What’s in the Developer Preview?

The Android 7.1 Developer Preview gives you everything you need to test your app on the new platform or extend it with new features like app shortcuts and image keyboard support. It includes an updated SDK and tools, documentation and samples, as well as emulators and device system images for running your apps on supported devices.

We’re continuing the model we used in N and earlier releases, and with Android 7.1 being an incremental release there are a few differences to highlight:

  • Since 7.1 has already launched on Pixel, we’re delivering the initial Developer Preview at beta quality for the Nexus lineup of devices. The goal is to tease out any device-specific issues.
  • We’ve finalized the new APIs as API Level 25
  • We’ve opened up publishing on Google Play for apps targeting the new API level, so you can update your apps soon as you are ready.

After the initial preview release, we plan to deliver an update in November followed by the final public release to the Android Open Source Project (AOSP) in December. Initially available on Nexus 5X, Nexus 6P, and Pixel C devices, we’ll extend the Developer Preview to other devices in November.

Get your apps ready for Android 7.1

To get started, update to Android Studio 2.2.2 and download API Level 25 platform, emulator system images and tools. The final API Level 25 SDK is available for download through the SDK Manager in Android Studio.

Once you’ve installed the API Level 25 SDK, you can update your project’s compileSdkVersion to 25 to build and test against the new APIs. If you’re doing compatibility testing, we recommend updating your app’s targetSdkVersion to 25 to test your app with compatibility behaviors disabled. For details on how to set up your app with the API Level 25 SDK, see Set up the Preview.

If you’re adding app shortcuts or circular launcher icons to your app, you can use Android Studio’s built-in Image Asset Studio to quickly help you create icons of different sizes that meet the material design guidelines.

The Google APIs Emulator System images shipped with the Android API Level 25 SDK include support for round icons and the new Google Pixel Launcher. The Google API system image allows you to test how your app’s circular app icons look in devices that support circular icons. Also, if you are developing live wallpapers, you can also use the the new system images with the Android Emulator to test the enhanced preview metadata in Android 7.1.

To help you add image keyboard support, you can use the Messenger and Google Keyboard apps included in the preview system images for testing as they include support for this new API.

Along with the API Level 25 SDK, we have also updated the Android Support Library to 25.0.0. The new version lets you add image keyboard support with compatibility back to API level 13. It also introduces BottomNavigationView widget, which implements the bottom navigation pattern from the material design guidelines.

For details on API Level 25 check out the API diffs and the updated API reference on the developer preview site.

Image keyboard support on Nexus 6P

You can use the Android Emulator in Android Studio to test your circular app icons & shortcuts in a launcher

App shortcuts on Nexus 6P

You can use the Image Asset tool to quickly create circular icon assets.

Publish your apps to alpha, beta or production channels in Google Play

Since the Android 7.1 APIs are final, you can publish updates compiling with, and optionally targeting, API 25 to Google Play. You can now publish app updates that use API 25 to your alpha, beta, or even production channels in the Google Play Developer Console. In this way, push your app updates to users whose devices are running Android 7.1, such as Pixel and Android Beta devices.

How to Get Android 7.1 Developer Preview on Your Eligible Device

If you are already enrolled in the Android Beta program, then your eligible enrolled devices will get the Android 7.1 Developer Preview update right away, no action is needed on your part. If you aren’t yet enrolled in Android Beta, the easiest way to get started is to visit android.com/beta and opt-in your eligible Android phone or tablet — you’ll soon receive this (and later) preview updates over-the-air. If you have an enrolled device and do not want to receive the update, just visit Android Beta and unenroll the device. You can also download and flash this update manually.

We welcome your feedback in the Developer Preview issue tracker, N Preview Developer community, or Android Beta community as we work towards the consumer release in December!


Android Developers Blog