Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 230cecd

Browse files
Auto-update
1 parent 6a94bb0 commit 230cecd

File tree

9 files changed

+116
-451
lines changed

9 files changed

+116
-451
lines changed

LICENSE

Lines changed: 0 additions & 444 deletions
Large diffs are not rendered by default.

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
This sample uses the following software:
33

4-
Copyright 2017 The Android Open Source Project
4+
Copyright 2018 The Android Open Source Project
55

66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ for an application targeting an SDK below M, the API will return empty or no dat
3131
Pre-requisites
3232
--------------
3333

34-
- Android SDK 26
35-
- Android Build Tools v26.0.1
34+
- Android SDK 27
35+
- Android Build Tools v27.0.2
3636
- Android Support Repository
3737

3838
Screenshots

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
jcenter()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.3.3'
7+
classpath 'com.android.tools.build:gradle:3.0.0'
88
}
99
}
1010

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

kotlinApp/.google/packaging.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2018 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# This file is used by Google as part of our samples packaging process.
16+
# End users may safely ignore this file. It has no relevance to other systems.
17+
---
18+
status: PUBLISHED
19+
technologies: [Android]
20+
categories: [System]
21+
languages: [Kotlin]
22+
solutions: [Mobile]
23+
github: android-RuntimePermissions
24+
level: BEGINNER
25+
license: apache2

kotlinApp/README.md

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

kotlinApp/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.3.3'
9+
classpath 'com.android.tools.build:gradle:3.0.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

kotlinApp/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 commit comments

Comments
 (0)