Home | History | Annotate | only in /developers/build/prebuilts/gradle/RuntimePermissions
Up to higher level directory
NameDateSize
.google/24-Aug-2016
Application/24-Aug-2016
build.gradle24-Aug-201611
CONTRIBUTING.md24-Aug-20161.5K
gradle/24-Aug-2016
gradlew24-Aug-20165K
gradlew.bat24-Aug-20162.3K
LICENSE24-Aug-201631.5K
README.md24-Aug-20163.5K
screenshots/24-Aug-2016
settings.gradle24-Aug-201622

README.md

      1 
      2 Android RuntimePermissions Sample
      3 ===================================
      4 
      5 This sample shows runtime permissions available in Android M and above.
      6 It shows how to check and request permissions at runtime, handle backwards compatibility using the
      7 support library and how to declare optional permissions for M-devices only.
      8 
      9 Introduction
     10 ------------
     11 
     12 Android M introduced runtime permissions. Applications targeting M and above need to request their
     13 permissions at runtime.
     14 All permissions still need to be declared in the AndroidManifest. However, when accessing APIs that
     15 require a permission, the Activity or Fragment has to verify that the permission has been granted
     16 or request the missing permissions using calls through the support library. Permissions are checked
     17 through  ActivityCompat#checkSelfPermission(Context, String) or
     18 ContextCompat#checkSelfPermission(Context, String).
     19 Permission are requested through ActivityCompat#requestPermissions(Activity, String[], int), and the response
     20 received in a callback to  ActivityCompat.OnRequestPermissionsResultCallback#onRequestPermissionsResult(int, String[], int[]).
     21 Applications can provide an additional rational for the use of permissions after calling
     22 ActivityCompat#shouldShowRequestPermissionRationale(Activity,String). This call will return true if the
     23 application should provide the user with more context on why the requested permissions is needed,
     24 for example if the permission request has been denied before.
     25 
     26 If an application targets an SDK below M, all permissions are granted at runtime and are available
     27 when the application is running. The support library calls handle these checks appropriately.
     28 However, if permissions have been turned off in the system settings
     29 for an application targeting an SDK below M, the API will return empty or no data.
     30 
     31 Pre-requisites
     32 --------------
     33 
     34 - Android SDK 23
     35 - Android Build Tools v23.0.3
     36 - Android Support Repository
     37 
     38 Screenshots
     39 -------------
     40 
     41 <img src="screenshots/screenshot-1.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot-2.png" height="400" alt="Screenshot"/> 
     42 
     43 Getting Started
     44 ---------------
     45 
     46 This sample uses the Gradle build system. To build this project, use the
     47 "gradlew build" command or use "Import Project" in Android Studio.
     48 
     49 Support
     50 -------
     51 
     52 - Google+ Community: https://plus.google.com/communities/105153134372062985968
     53 - Stack Overflow: http://stackoverflow.com/questions/tagged/android
     54 
     55 If you've found an error in this sample, please file an issue:
     56 https://github.com/googlesamples/android-RuntimePermissions
     57 
     58 Patches are encouraged, and may be submitted by forking this project and
     59 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
     60 
     61 License
     62 -------
     63 
     64 Copyright 2016 The Android Open Source Project, Inc.
     65 
     66 Licensed to the Apache Software Foundation (ASF) under one or more contributor
     67 license agreements.  See the NOTICE file distributed with this work for
     68 additional information regarding copyright ownership.  The ASF licenses this
     69 file to you under the Apache License, Version 2.0 (the "License"); you may not
     70 use this file except in compliance with the License.  You may obtain a copy of
     71 the License at
     72 
     73 http://www.apache.org/licenses/LICENSE-2.0
     74 
     75 Unless required by applicable law or agreed to in writing, software
     76 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
     77 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
     78 License for the specific language governing permissions and limitations under
     79 the License.
     80