Tampilkan postingan dengan label Android Wear. Tampilkan semua postingan
Tampilkan postingan dengan label Android Wear. Tampilkan semua postingan

Rabu, 18 November 2015

API 23 SDK now available for Android Wear

Posted by Wayne Piekarski, Developer Advocate



The new LG Watch Urbane 2nd Edition LTE is the first watch to run Android 6.0 Marshmallow (API 23) for Android Wear. Currently, all other Android Wear watches implement API 22, and in the coming months, these will receive an OTA update for API 23 as well.



So what does this mean for you as an Android Wear developer? You will need to ensure that your apps are compatible with both API 23 and API 22 watches. While you can start implementing the new features in this post, you still need to maintain backwards compatibility until all watches are upgraded.



New permissions model and samples


API 23 introduces a new runtime permissions model for both phones and watches. The new permissions model allows users to pick and choose which permissions to grant apps at the time of use. In addition, new permissions settings allow users to turn on and off app permissions at any time.



To use the new permissions model on Wear, read Permissions on Android Wear. This training guide provides an in-depth discussion of Wear-specific scenarios, such as when your Wear app relies on a phone-side permission. In addition, all of the Android Wear samples have been updated to use the new permissions model, and a new RuntimePermissionsWear sample shows how to handle permission requests across devices.



When you are ready, you can update your application on both the phone and watch side to use compileSdkVersion 23 and targetSdkVersion 23. Make sure that you check and request the permissions needed by your app at runtime, on both the phone and the watch. It is important that you do not change targetSdkVersion to 23 until you have implemented the permission checks properly, since it changes how the system installs and runs the app. For example, an API call that might have previously returned a result could now fail, causing the app to behave in unexpected ways.






-round and -notround resource qualifiers


API 23 makes it easier to build apps for both round and square Android Wear watches. We listened to your feedback and added new resource qualifiers for -round and -notround, so you can use the resource system to load the appropriate images, layouts, and strings based on the type of watch you are working with. You can also combine this with existing resource qualifiers -hdpi, -tvdpi, -280dpi, and -360dpi for the various Android Wear watches that are currently available. All of the existing classes in the wearable UI library, such as WatchViewStub, BoxInsetLayout, and WearableFrameLayout will continue to work as well, so you do not need to change your code. The -round and -notround resource qualifiers will not work on API 22 devices, so you cannot assume they will be available until all devices are on API 23.



Watches with speakers


The LG Watch Urbane 2nd Edition LTE is the first watch to include speaker support, so you can now add sounds to your Wear app. You can play audio files using the same APIs that are available on Android phones, such as AudioTrack, MediaPlayer, and ExoPlayer. Check out the sample and documentation to learn how to detect when the speaker is available on a Wear device and play sounds through it.



Intel x86 support


The new TAG Heuer Connected, along with other upcoming Android Wear watches, is based on Intel x86 processors. If you are working only with Java code, your apps will automatically work on any architecture. However, if you’re using the NDK, you’ll need to provide both armeabi-v7a and x86 shared libraries in your wearable APK. Since only one wearable app can be bundled in a phone app, it is not possible to deliver different APKs to different watches based on architecture. If your wearable APK is missing an x86 library, it will fail to install on x86 watches with INSTALL_FAILED_NO_MATCHING_ABIS and code -113.



If you are using Android Studio, you will need to adjust your build.gradle file to include:


ndk {
abiFilters = ['armeabi-v7a','x86']
}

If you are using the NDK directly, you will need to modify your Application.mk file to use:


APP_ABI := armeabi-v7a x86


These changes should only be made for the wearable APK, and you can continue to support other ABIs on the phone side. You can test your application by checking if it works on the x86 emulator provided by the SDK Manager.



Updated emulator


New Android Wear emulator images for API 23 and x86 watches are available to download from the SDK Manager in Android Studio. We have also added profiles that represent every available Android Wear watch, so you can easily test on any device you want. It is also important that you understand and test all the combinations of phones (API <= 22, API = 23) and wearables (API 22, API 23), so that your app works for all users.



Updates to existing watches


The new emulator images allow you to get started immediately with testing and deploying updated apps for users with API 23 watches. The schedule for updating existing Android Wear watches via OTA updates has not been announced yet. We will announce the update schedule on the Android Wear Developers Google+ community. We’ll also let you know when the rollout is complete, and API 22 support for Android Wear is no longer needed.


Rabu, 21 Oktober 2015

New Courses -- Developing Watch Apps for Android Wear

Posted by Wayne Piekarski, Developer Advocate



We recently released a new Udacity course on Ubiquitous Computing with Android Wear, built as a collaboration between Udacity and Google. Android Wear watches allow users to get access to their information quickly, with just a glance, using an always-on display. By taking this course, you will learn everything you need to know to reach your users with notifications, custom watch faces, and even full apps.



Designed by Developer Advocates from Google, the course is a practical approach to getting started with Android Wear. It takes you through code snippets, and deep dives into sample code, showing you how easy it is to extend your existing Android apps to work on Android Wear. It also covers how to design user interfaces and great experiences for this unique wearable platform, which is important because the interface of the watch needs to be glanceable and unobtrusive for all day use.








This class is part of our larger series on Ubiquitous Computing across Google platforms, such as Android Wear, Android Auto, Android TV, and Google Cast. Designed as short, standalone courses, you can take any course on its own, or take them all! The Android Wear platform is a great opportunity to add functionality that will distinguish your app from others; and this Udacity course will get you up to speed quickly and easily.



Get started now and try it out at no cost, your users are waiting!



Kamis, 20 Agustus 2015

Interactive watch faces with the latest Android Wear update

Posted by Wayne Piekarski, Developer Advocate



The Android Wear team is rolling out a new update that includes support for interactive watch faces. Now, you can detect taps on the watch face to provide information quickly, without having to open an app. This gives you new opportunities to make your watch face more engaging and interesting. For example, in this animation for the Pujie Black watch face, you can see that just touching the calendar indicator quickly changes the watch face to show the agenda for the day, making the watch face more helpful and engaging.





Interactive watch face API


The first step in building an interactive watch face is to update your build.gradle to use version 1.3.0 of the Wearable Support library. Then, you enable interactive watch faces in your watch face style using setAcceptsTapEvents(true):



setWatchFaceStyle(new WatchFaceStyle.Builder(mService)
.setAcceptsTapEvents(true)
// other style customizations
.build());


To receive taps, you can override the following method:



@Override
public void onTapCommand(int tapType, int x, int y, long eventTime) { }


You will receive events TAP_TYPE_TOUCH when the user initially taps on the screen, TAP_TYPE_TAP when the user releases their finger, and TAP_TYPE_TOUCH_CANCEL if the user moves their finger while touching the screen. The events will contain (x,y) coordinates of where the touch event occurred. You should note that other interactions such as swipes and long presses are reserved for use by the Android Wear system user interface.



And that’s it! Adding interaction to your existing watch faces is really easy with just a few extra lines of code. We have updated the WatchFace sample to show a complete implementation, and design and development documentation describing the API in detail.



Wi-Fi added to LG G Watch R



This release also brings Wi-Fi support to the LG G Watch R. Wi-Fi support is already available in many Android Wear watches and allows the watch to communicate with the companion phone without requiring a direct Bluetooth connection. So, you can leave your phone at home, and as long as you have Wi-Fi, you can use your watch to receive notifications, send messages, make notes, or ask Google a question. As a developer, you should ensure that you use the Data API to abstract away your communications, so that your application will work on any kind of Android Wear watch, even those without Wi-Fi.



Updates to existing watches



This update to Android Wear will roll out via an over-the-air (OTA) update to all Android Wear watches over the coming weeks. The wearable support library version 1.3 provides the implementation for touch interactions, and is designed to continue working on devices which have not been updated. However, the touch support will only work on updated devices, so you should wait to update your apps on Google Play until the OTA rollout is complete, which we’ll announce on the Android Wear Developers Google+ community. If you want to release immediately but check if touch interactions are available, you can use this code snippet:



PackageInfo packageInfo = PackageManager.getPackageInfo("com.google.android.wearable.app", 0);
if (packageInfo.versionCode > 720000000) {
// Supports taps - cache this result to avoid calling PackageManager again
} else {
// Device does not support taps yet
}





Android Wear developers have created thousands of amazing apps for the platform and we can’t wait to see the interactive watch faces you build. If you’re looking for a little inspiration, or just a cool new watch face, check out the Interactive Watch Faces collection on Google Play.



Rabu, 24 Juni 2015

Android Developer Story: Shifty Jelly drives double-digit growth with material design and expansion to the car and wearables

Posted by Lily Sheringham, Google Play team



Pocket Casts is a leading podcasting app on Google Play built by Australian-based mobile development company Shifty Jelly. The company recently achieved $1 million in sales for the first time, reaching more than 500K users.



According to the co-founder Russell Ivanovic, the adoption of material design played a significant role in driving user engagement for Pocket Casts by streamlining the user experience. Moreover, users are now able to access the app beyond the smartphone -- in the car with Android Auto, on a watch with Android Wear or on the TV with Google Cast. The rapid innovation of Android features helped Pocket Casts increase sales by 30 percent.



We chatted with co-founders and Android developers Russell and Philip Simpson to learn more about how they are growing their business with Android.





Here are some of the features Pocket Casts used:


  • Material Design: Learn more about material design and how it helps you create beautiful, engaging apps.

  • Android Wear: Extend your app to Android Wear devices with enhanced notifications or a standalone wearable app.

  • Android Auto: Extend your app to an interface that’s optimized for driving with Android Auto.

  • Google Cast: let your users cast your app’s content to Google Cast devices like Chromecast, Android TV, and speakers with Google Cast built-in.


And check out the Pocket Casts app on Google Play!



Selasa, 23 Juni 2015

Fitness Apps on Android Wear

Posted by Joshua Gordon, Developer Advocate



Go for a run, improve your game, and explore the great outdoors with Android Wear! Developers are creating a diverse array of fitness apps that provide everything from pace and heart rate while running, to golf tips on your favorite course, to trail maps for hiking. Let’s take a look features of the open and flexible Wear platform they use to create great user experiences.



Always-on stats



If your app supports always-on, you’ll never have to touch or twist your watch to activate the display. Running and want to see your pace? Glance at your wrist and it’s there! Runtastic, Endomondo, and MapMyRun use always-on to keep your stats visible, even in ambient mode. When it’s time for golf, I use Golfshot. Likewise, Golfshot uses always-on to continuously show yardage to the hole, so I never have to drop my club. Check out the doc, DevByte, and code sample to learn more.





















Runtastic automatically transitions to ambient mode to conserve battery. There, it reduces the frequency at which stats are updated to about once per 10 seconds.





Maps, routes, and markers



It's encouraging to see how much ground I’ve covered when I go for a run or ride! Using the Maps API, you can show users their route, position, and place markers on the map they can tap to see more info you provide. All of this functionality is available to you using the same Maps API you’ve already worked with on Android. Check out the doc, DevByte, code sample, and blog post to learn more.






















Endomondo tracks your route while your run. You can pan and zoom the map.






Google Fit



Google Fit is an open platform designed to make it easier to write fitness apps. It provides APIs to help with many common tasks. For example, you can use the Recording API to estimate how many steps the user has taken and how many calories they've burned. You can make that data to your app via the History API, and even access it over the web via REST, without having to write your own backend. Now, Google Fit can store data from a wide variety of exercises, from running to weightlifting. Check out the DevByte and code samples to learn more.



Bluetooth Low Energy: pair with your watch



With the latest release of Android Wear, developers can now pair BLE devices directly with the Wearable. This is a great opportunity for all fitness apps -- and especially for running -- where carrying both a phone and the Wearable can be problematic. Imagine if your users could pair their heart rate straps or bicycle cadence sensors directly to their Wear device, and leave their phones at home. BLE is now supported by all Wear devices, and is supported by Google Fit. To learn more about it, check out this guide and DevByte.



Pack light with onboard GPS



When I’m running, carrying both a phone and a wearable can be a bit much. If you’re using an Android Wear device that supports onboard GPS, you can leave your phone at home! Since not all Wear devices have an onboard GPS sensor, you can use the FusedLocationProviderApi to seamlessly retrieve GPS coordinates from the phone if not available on the wearable. Check out this handy guide for more about detecting location on Wear.






















RunKeeper supports onboard GPS if it’s available on your Wearable.





Sync data transparently



When I’m back home and ready for more details on my activity, I can see them by opening the app on my phone. My favorite fitness apps transparently sync data between my Wearable and phone. To learn more about syncing data between devices, watch this DevByte on the DataLayer API.



Next Steps



Android Wear gives you the tools and training you need to create exceptional fitness apps. To get started on yours, visit developer.android.com/wear and join the discussion at g.co/androidweardev.



Kamis, 28 Mei 2015

A Closer Look at Google Play services 7.5

Posted by Ian Lake, Developer Advocate



At Google I/O, we announced the rollout of Google Play services 7.5 that deliver new capabilities and optimizations to devices across the Android ecosystem. Google Play services ensures that you can build on the latest features from Google for your users, with the confidence that those services will work properly on Android 2.3 and higher devices.



You’ll find the addition of Smart Lock for Passwords, Instance ID, new APIs for Google Cloud Messaging and Google Cast, as well as access to the Google Maps API on Android Wear devices.



Smart Lock for Passwords



Typing in a password, particularly on a mobile device, is never a pleasant experience. In many cases, your users have already logged in on the web or another device - shouldn’t your login process know that? Smart Lock for Passwords builds on the Chrome Password Manager, adding a new CredentialsApi API and UI on Android to retrieve saved credentials as part of your login process and saving new credentials for later use on other Android devices and any Chrome browser. Both password-based and Identity Provider (IDP, like Google Sign-In) credentials are supported. Keep your users logged in as they move between and to new devices; don’t let them drop off, get frustrated, or end up with multiple accounts.





Learn more about Smart Lock for Passwords on the developer site.



Instance ID, Identity, and Authorization



Instance ID (IID) allows you to retrieve a unique identifier for every app instance, providing a mechanism to authenticate and authorize actions, even if your app does not have user registration and accounts. For example, this allows you to uniquely determine which app instance is sending a request from by including the Instance ID token. We’ve also made it easy to handle edge cases to ensure that you’ll have valid Instance ID tokens.



Google Cloud Messaging



Google Cloud Messaging (GCM) gives developers a battery efficient mechanism for sending information to your users as well as send upstream messages from a device to your server.



Google Cloud Messaging and InstanceID



Previously, GCM used a unique registration ID to refer to each device - while these IDs will continue to work, you can now utilize Instance ID tokens for GCM, gaining all of the advantages of InstanceID around handling error cases. Instance ID tokens are fully compatible with user notifications, allowing you to send notifications to all of a user's devices.



Topic based subscriptions



You’ll also get another new feature for switching to InstanceID with GCM - topic based subscriptions! This makes it easy to publish a message to exactly the right audience and have GCM handle all the heavy lifting of sending to all subscribed instances. Your app can subscribe to multiple topics, allowing you to create any set of topics needed to best handle your app’s messaging needs.



Receiving messages with GCM



Of course, just subscribing to receive messages is only half the battle: receiving GCM messages can now be done using a GcmReceiver and a subclass of GcmListenerService. These two classes make it easy to help your app reliably process messages, even when the device is awakened from deep sleep.



GCM Network Manager



Applications often need to sync data with their servers when new information is available. In GCM we refer to this model as “send to sync”. We made this task much simpler with the introduction of the GCM Network Manager APIs, which handles many of the common implementation patterns such as waiting for network connectivity, device charging, network retries, and backoff. GcmNetworkManager will schedule your background tasks when it is most appropriate and it can batch multiple tasks together for efficiency and battery savings, even utilizing the JobScheduler APIs for best performance on Android 5.0+ devices. With support for both one-off tasks and periodic tasks, this API serves as a flexible framework for many different types of operations.



App Invites Beta



Now in beta, App Invites is new functionality for both Android and iOS that provides a standard UI for users to invite their contacts to install your app and optionally deep link specifically to selected content, using your users’ device and Google-wide contacts as a source to drive referrals to increase the reach of your app.





With the ability to send invites via SMS or email, this provides a great mechanism to organically grow your user base, give your users a consistent way to share your app with exactly who would like it, and track how effective your invites are.



With App Invites, our goal is to take the hard work out of building user referral and onboarding flows, so that you can focus on your core app experience. Learn more about App Invites on the developer site!



Google Cast



Google Cast is a technology that lets you easily cast content from your mobile device or laptop right to your TV or speakers. With the new ability to use remote display on any Android, iOS, or Chrome app, better media support, better game support, we hope your Google Cast experience is better than ever!



Remote Display API



We are making it easy for mobile developers to bring graphically intensive apps or games to Google Cast receivers with Google Cast Remote Display APIs for Android and iOS. The new Remote Display API allows you to build a tailored, integrated second screen experience, without requiring an identical mirroring of content between mobile devices and the Google Cast device.



Learn more about Remote Display on the Google Cast Developers Site!



Autoplay and Queuing APIs



Playing single media items on Chromecast has been something RemoteMediaPlayer (or CastCompanionLibrary’s VideoCastController) has been doing well for some time. With this release, RemoteMediaPlayer is gaining a full media queue and support for autoplay for a seamless media playback experience. This ensures that all connected devices can easily maintain a synchronized queue of upcoming media items, opening up new possibilities of creating collaborative Google Cast media experiences.



Game Manager APIs for Google Cast



Bringing your game to Google Cast can make for a great multiplayer experience, using a mobile device as a game controller and the TV to display the action. To make it easier to send messages and state changes to all connected clients and the cast receiver, Google Play services 7.5 introduces the GameManagerClient and the Game Manager APIs for Google Cast, available for Android, iOS, Chrome, and for receivers.



Android Wear



Watches are great devices for telling time. But what if in addition showing you when you are, watches could easily show you where you are? With the new release, you can now use the familiar Maps APIs on Android Wear devices:





This makes it possible to display fully interactive maps, as well as lite mode maps, directly on Android Wear devices. You’ll be able to scroll and zoom interactive maps, show the user’s current location, and more. Check out the full list of supported features in the developer documentation and check out all the details on the Geo Developers blog.



Google Fit


Google Fit is an open platform designed to make building fitness apps, whether that means retrieving sensor data like current location and speed, collecting and storing activity data, or automatically aggregating that data into a single view of the user’s fitness data.



You’ll now be able to use the RecordingApi for gathering estimated distance traveled and calories burned data, making it available to your app and other Google Fit enabled apps via the HistoryApi.



Being active can take many forms. While some activities are easily measured in terms of steps or distance, strength training is measured in terms of type, resistance and repetitions. This type of data can now be stored in Google Fit via new support for a large number of workout exercises, helping users build a complete view of their activity.



SDK is now available!



Google Play services 7.5 is now available: get started with updated SDK now!



To learn more about Google Play services and the APIs available to you through it, visit the Google APIs for Android site.



Kamis, 21 Mei 2015

Always-on and Wi-Fi with the latest Android Wear update

Posted by Wayne Piekarski, Developer Advocate



A new update to Android Wear is rolling out with lots of new features like always-on apps, Wi-Fi connectivity, media browsing, emoji input, and more. Let’s discuss some of the great new capabilities that are available in this release.



Always-on apps



Above all, a watch should make it easy to tell the time. That's why most Android Wear watches have always-on displays, so you can see the time without having to shake your wrist or lift your arm to wake up the display. In this release, we're making it possible for apps to be always-on as well.



With always-on functionality, your app can display dynamic data on the device, even when the app is in ambient mode. This is useful if your app displays information that is continuously updated. For example, running apps like Endomondo, MapMyRun, and Runtastic use the always-on screen to let you keep track of how long and far you’ve been running. Zillow keeps you posted about the median price of homes nearby when you’re house-hunting.



Always-on functionality is also useful for apps that may not update data very frequently, but present information that’s useful for reference over a longer period of time. For example, Bring! lets you keep your shopping list right on your wrist, and Golfshot gives you accurate distances from tee to pin. If you’re at the airport and making your way to your gate, American Airlines, Delta, and KLM let you keep all of your flight info a glance away on your watch.



Note: the above apps will not display always-on functionality on your watch until you receive the update for the latest version of Android Wear.



Always-on functionality works similar to watch faces, in that the power usage of the display and processor is kept to a minimum by reducing the colors and refresh rate of the display. To implement an always-on Activity, you need to make a few small changes to your app's AndroidManifest.xml, your app’s build.gradle, and the Activity to declare that it supports ambient mode. A code sample and documentation are available to show you how it works. Be sure to tune in to the livestream at Google I/O next week for Android Wear: Your app and the always-on screen.





Wi-Fi connectivity and cloud sync



Many existing Android Wear devices already contain hardware support for Wi-Fi, and this release enables software support for Wi-Fi. The saved Wi-Fi networks on your phone are copied to your watch during setup, and your watch automatically connects to those Wi-Fi networks when it loses Bluetooth connection to your phone. Your watch can then connect to your phone over the Internet, even if they’re not on the same Wi-Fi network.



You should continue to use the Data Layer API for all communications between the watch and phone. By using this standard API, your app will always work, no matter what kind of connectivity the user’s wearable supports. Cloud sync also introduces a new virtual node in the Data Layer called the cloud node, which may be returned in calls to getConnectedNodes(). Learn more in the Multi-wearable support section below.



Multi-wearable support



The release of Google Play services 7.3 now allows support for multiple wearable devices to be paired simultaneously to a single phone or tablet, so you can have a wearable for fitness, and another for dressing up. While DataItems will continue to work in the same way, since they are synchronized to all devices, working with the MessageApi is a little different. When you update your build.gradle to use version 7.3 or higher, getConnectedNodes() from the NodeApi will usually return multiple nodes. There is an extra virtual node added to represent the cloud node used to communicate over Wi-Fi, so all developers need to deal with this situation in their code.



To help simplify finding the right node among many devices, we have added a CapabilityApi, allowing your nodes to announce features they provide, for example downloading images or music. You can also now use the ChannelApi to open up a connection to a specific device to transfer large resources such as images or audio streams, without having to send them to all devices like you would when embedding assets into data items. We have updated our Android Wear samples and documentation to show the best practices in implementing this.



MediaBrowser support



The Android 5.0 release added the ability for apps to browse the media content of another app, via the android.media.browse API. With the latest Android Wear update, if your media playback app supports this API, then you will be able to browse to find the next song directly from your watch. This is the same browse capability used in Android Auto. You implement the API once, and it will work across a variety of platforms. To do so, you just need to allow Android Wear to browse your app in the onGetRoot() method validator. You can also add custom actions to the MediaSession that will appear as controls on the watch. We have a Universal Media Player sample that shows you how to implement this functionality.



Updates to existing devices



The latest version of Android Wear will roll out via an over-the-air (OTA) update to all Android Wear watches over the coming weeks. To take advantage of these new features, you will need to use targetSdkVersion 22 and add the necessary dependencies for always-on support. We have also expanded the collection of emulators available via the SDK Manager, to simulate the experience on all the currently available devices, resolutions, and shapes, including insets like the Moto 360.



In this update, we have also disabled support for apps that use the unofficial, activity-based approach for displaying watch faces, as announced in December. These watch faces will no longer work and should be updated to use the new watch face API.



Since the launch of Android Wear last summer, Android Wear has grown into a platform that gives users many possibilities to personalize their watches, with a variety of shapes and styles, a range of watch bands, and thousands of apps and watch faces. Features such as always-on apps and Wi-Fi allow developers even more flexibility to give users amazing experiences with Android Wear.