1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2013 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16--> 17 18<sample> 19 <name>RuntimePermissionsWear</name> 20 <group>Wearable</group> 21 <package>com.example.android.wearable.runtimepermissions</package> 22 23 <minSdk>18</minSdk> 24 <targetSdkVersion>28</targetSdkVersion> 25 26 <minSdkVersionWear>23</minSdkVersionWear> 27 <targetSdkVersionWear>28</targetSdkVersionWear> 28 <multiDexEnabled>true</multiDexEnabled> 29 30 <wearable> 31 <has_handheld_app>true</has_handheld_app> 32 </wearable> 33 34 <androidX>true</androidX> 35 36 <dependency>androidx.appcompat:appcompat:1.0.2</dependency> 37 <dependency>com.google.android.material:material:1.0.0</dependency> 38 <dependency>androidx.legacy:legacy-support-v13:1.0.0</dependency> 39 40 <dependency_wearable>androidx.wear:wear:1.0.0</dependency_wearable> 41 <dependency_wearable>androidx.legacy:legacy-support-v13:1.0.0</dependency_wearable> 42 43 44 <strings> 45 <intro> 46<![CDATA[ 47A sample that shows how you can handle remote data that requires permissions both on 48a wearable device and a mobile device. 49]]> 50 </intro> 51 </strings> 52 53 <!-- The basic templates have already been enabled. Uncomment more as desired. --> 54 <template src="base" /> 55 <template src="WearPlusShared"/> 56 57 <metadata> 58 <!-- Values: {DRAFT | PUBLISHED | INTERNAL | DEPRECATED | SUPERCEDED} --> 59 <status>PUBLISHED</status> 60 <!-- See http://go/sample-categories for details on the next 4 fields. --> 61 <categories>Wearable, Permissions</categories> 62 <technologies>Android</technologies> 63 <languages>Java</languages> 64 <solutions>Mobile</solutions> 65 <level>INTERMEDIATE</level> 66 <!-- Dimensions: 512x512, PNG fomrat --> 67 <icon>screenshots/icon-web.png</icon> 68 <!-- Path to screenshots. Use <img> tags for each. --> 69 <screenshots> 70 <img>screenshots/screenshot-wear.png</img> 71 <img>screenshots/screenshot-phone.png</img> 72 </screenshots> 73 <!-- List of APIs that this sample should be cross-referenced under. Use <android> 74 for fully-qualified Framework class names ("android:" namespace). 75 76 Use <ext> for custom namespaces, if needed. See "Samples Index API" documentation 77 for more details. --> 78 <api_refs> 79 <android>android.support.v4.app.ActivityCompat</android> 80 <android>android.support.v7.app.AppCompatActivity</android> 81 <android>android.support.wearable.activity.WearableActivity</android> 82 <android>android.support.wearable.view.WatchViewStub</android> 83 <android>com.google.android.gms.common.api.GoogleApiClient</android> 84 <android>com.google.android.gms.wearable.CapabilityApi</android> 85 <android>com.google.android.gms.wearable.CapabilityInfo</android> 86 <android>com.google.android.gms.wearable.DataMap</android> 87 <android>com.google.android.gms.wearable.MessageApi</android> 88 <android>com.google.android.gms.wearable.MessageEvent</android> 89 <android>com.google.android.gms.wearable.Node</android> 90 <android>com.google.android.gms.wearable.Wearable</android> 91 <android>com.google.android.gms.wearable.WearableListenerService</android> 92 </api_refs> 93 94 <!-- 1-3 line description of the sample here. 95 96 Avoid simply rearranging the sample's title. What does this sample actually 97 accomplish, and how does it do it? --> 98 <description> 99A sample that shows how you can handle remote data that requires permissions both on 100a wearable device and a mobile device. 101 </description> 102 103 <!-- Multi-paragraph introduction to sample, from an educational point-of-view. 104 Makrdown formatting allowed. This will be used to generate a mini-article for the 105 sample on DAC. --> 106 <intro> 107<![CDATA[ 108Steps for trying out this sample: 109* Compile and install the mobile app onto your mobile device or emulator. 110* Compile and install the wearable app onto your Wear device or emulator. 111(**Note:** wearable apps are not automatically pushed from your mobile device 112unless you build a production release, see [here][3] for more info). 113* Start the mobile or wear app. Each app contains two buttons: one for showing 114local data and another for showing remote data. 115* Click either button to view the data. Both local and remote data require 116[dangerous permissions][4] to be approved before displaying the data for 117devices running 23 or above. You will be asked to approve the access if you 118do not have the proper permissions. 119* The happy icon signifies you have access to the data while the sad icon 120signifies you do or may not have access (and may be asked to approve access). 121 122This sample demonstrates how to access data and trigger permission approval 123on remote devices. It uses [Services][5] and the [Wearable MessageApi][2] to 124communicate between devices. 125 126To find out more about wear, visit our [developer Wear page][1]. 127 128[1]: http://developer.android.com/wear/ 129[2]: https://developer.android.com/reference/com/google/android/gms/wearable/MessageApi.html 130[3]: https://developer.android.com/training/wearables/apps/creating.html#Install 131[4]: http://developer.android.com/guide/topics/security/permissions.html#normal-dangerous 132[5]: http://developer.android.com/guide/components/services.html 133]]> 134 </intro> 135 </metadata> 136</sample> 137