In Android Wear 2.0, an app can work independently of a phone. Users can complete more tasks on a watch, without access to an Android or iOS phone.
Planning Your Phone and Watch Apps
A watch APK targeting Wear 2.0 should not be embedded in a phone APK. For information about setting up your app for distribution through the Play Store, see Packaging and Distributing Wear Apps.
Generally, the minimum and target API level for a standalone app, and for Wear 2.0, is level 25. The minimum SDK level can be 23 only if you are using the same APK for Wear 1.0 and 2.0 (and thus have an embedded Wear 1.0 APK).
If you build a standalone Wear 2.0 APK and will continue to have a Wear 1.0 APK, please do both of the following:
- Provide a standalone version of the Wear APK, and
- Continue embedding a version of the Wear APK in your phone APK
Caution: If you publish an update to your existing, production phone APK that has removed an embedded Wear APK, production users who update the phone APK before installing your standalone Wear APK will lose their existing Wear app and its data. If you publish an update to your existing, production phone APK, continue to embed your watch APK into that phone APK.
Run-time permissions are required for standalone apps.
For information about network requests and high-bandwidth network access, see Network Access and Syncing.
Identifying an app as standalone
Wear 2.0 requires a
meta-data element in the Android Manifest file of watch apps,
as a child of the
The name of the
com.google.android.wearable.standalone and the
value must be
false. The element
indicates whether your watch app is a standalone app and thus doesn't
require a phone-side Android app to operate. If the setting for the element
true, your app can be made available in the
Play Store on watches paired to iPhones, as long as
your active APKs in all channels (e.g., in the
have the element set to
If not all of your APKs (alpha, beta, and production)
that currently are served to users
have the above setting, your app will be unavailable when
a user searches on a watch paired to an iPhone.
A watch app may or may not be considered standalone. A watch app can be categorized as one of the following:
- Completely independent of a phone app
- Semi-independent (a phone app is not required and would provide only optional features)
- Dependent on a phone app
If a watch app is completely independent or semi-independent, set the
value of the new
meta-data element to
<application> ... <meta-data android:name="com.google.android.wearable.standalone" android:value="true" /> ... </application>
Since a standalone app (that is, an independent or semi-independent app) can be installed by an iPhone user or a user of an Android phone that lacks the Play Store, the watch app should be usable without the phone app.
If a watch app depends on a phone app, set the value of the above
meta-data element to
false. Setting the element
false signifies that the watch app should be installed
only on a watch that is paired with a phone that has the Play Store.
Note: Even if the value is
false, the watch
app can be installed before the phone app is installed.
Therefore, if a watch app
detects that a companion phone
lacks a necessary phone app, the watch app should
prompt the user to install the phone app.
Shared Code and Data Storage
Code can be shared between a Wear app and a phone app. Optionally, code that is specific to a form factor can be in a separate module.
For example, common code for networking can be in a shared library.
You can use standard Android storage APIs to store data locally. For example, you can use the SharedPreferences APIs, SQLite, or internal storage (as you would in the case of a phone).
Detecting Your App on Another Device
Your watch app can detect if the corresponding phone app is available and vice versa.
Your phone app or watch app can use the
CapabilityApi to advertise the app's presence
to a paired device. It can do so statically and dynamically. When an app
is on a node in a user's Wear network (i.e., on a phone, paired watch, or
in the cloud), the
CapabilityApi enables another
app to detect if it is installed. For more information, see
If one of your apps cannot detect the other, you can enable a user to open the Play Store listing on their remote device. This is a solution for watch apps that require their companion phone app's presence to function properly. A prerequisite is to check for the Play Store's presence on the remote device.
Note that not all phones support the Play Store (such as iPhones, etc.).
This section describes best practices for these scenarios:
- Your standalone watch app needs your phone app
- Your phone app needs your standalone watch app
Please review the sample
that shows this functionality. For more information
about the classes described below, see the
Wear API Reference.
Also in that reference is information about the
PlayStoreAvailability class, which contains a
getPlayStoreAvailabilityOnPhone() method that enables your
Wear app to check if a companion phone has the Play Store.
Specifying capability names for detecting your apps
For the app corresponding to each device type (watch or phone), specify a
unique string for the capability name in the
For example, in your mobile module, the
could include the following:
<resources> <string-array name="android_wear_capabilities"> <item>verify_remote_example_phone_app</item> </string-array> </resources>
In your wear module, the
wear.xml file would include a
different value for the capability name,
such as the following:
<resources> <string-array name="android_wear_capabilities"> <item>verify_remote_example_wear_app</item> </string-array> </resources>
For more information, see Advertise capabilities.
App detection and opening a URL from a watch
Your watch app can detect if a user's companion phone has your phone app:
- Use the
CapabilityApito check if your phone app is installed on the paired phone. For more information, see the sample.
- If your phone app isn't installed on the phone, use
PlayStoreAvailability.getPlayStoreAvailabilityOnPhone()to check the type of the phone.
PlayStoreAvailability.PLAY_STORE_ON_PHONE_AVAILABLEis returned, the phone is an Android phone with the Play Store installed. Call
RemoteIntent.startRemoteActivity()on the Wear device to open the Play Store on the phone. Use the market URI for your phone app (which may be different from your phone URI). For example, use a market URI such as:
PlayStoreAvailability.PLAY_STORE_ON_PHONE_UNAVAILABLEis returned, it means the phone is likely an iOS phone (with no Play Store available). Open the App Store on the iPhone by calling
RemoteIntent.startRemoteActivity()on the Wear device. You can specify your app's iTunes URL, e.g.,
https://itunes.apple.com/us/app/yourappname. On an iPhone, from Android Wear, you cannot programmatically determine if your phone app is installed. As a best practice, provide a mechanism to the user (e.g., a button) to manually trigger the opening of the App Store.
Note that using the
RemoteIntent API described above,
you can specify that any URL be opened on the phone from the watch,
and no phone app is required.
Details for detecting Play Store availability
Here is a snippet that uses the
method to check if the paired phone has the Play Store:
int playStoreAvailabilityOnPhone = PlayStoreAvailability.getPlayStoreAvailabilityOnPhone(context);
The value returned by the
method is one of the following:
||The Play Store is available on the companion phone.|
||The Play Store is not available on the companion phone.|
||An error occurred in the check for the Play Store; another check should be made later.|
App detection starting from an Android phone
Your Android phone can detect if a user's Wear devices have your watch app:
- Using the
NodeApi, find all watches connected to the user's phone. For more information, see the sample.
- Using the
CapabilityApi, check which of the user's watches have your app installed.
- If your app isn't installed on all of the user's watches
(compare the results from Step 1 with the results from
Step 2), allow the user to open the
Play Store on the remaining Wear devices from the phone via the
RemoteIntent.startRemoteActivity()method. Specifically, use the market URI for the Wear app (which may be different from your phone app's URI). For example, use a market URI such as:
Location Data for Watches Paired to iPhones
If the companion phone is available, FLP uses the companion phone for location data.
Obtaining Only the Necessary Data
Generally, when obtaining data from the internet, you should get only the necessary data. Otherwise, you may introduce unnecessary latency, memory use, and battery use.
When a watch is connected over a Bluetooth LE connection, your app may have access to a bandwidth of only 4 kilobytes per second, depending on the watch. Therefore, the following steps are recommended:
- Audit your network requests and responses for extra data that only is for a phone app
- Shrink large images before you send them over a network to a watch
For cases where a high-bandwidth network is needed, see High-bandwidth Network Access.