• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.google/23-Nov-2023-1812

Application/23-Nov-2023-1,963994

gradle/wrapper/23-Nov-2023-66

screenshots/23-Nov-2023-

CONTRIB.mdD23-Nov-20231.6 KiB3627

CONTRIBUTING.mdD23-Nov-20231.5 KiB3627

LICENSED23-Nov-202311.1 KiB204170

README.mdD23-Nov-20233.6 KiB10375

build.gradleD23-Nov-202314 150

gradlewD23-Nov-20235 KiB165122

gradlew.batD23-Nov-20232.3 KiB9166

settings.gradleD23-Nov-202322 21

README.md

1
2Android AppRestrictionSchema Sample
3===================================
4
5A basic app showing how to allow a device administrator to restrict user
6activities using the Android Device Administration API. The app exports
7a custom policy that enables or disables a UI control. Device Administration
8applications are able to enforce a specific value for this policy, as
9directed by enterprise administrators.
10
11Introduction
12------------
13
14The [Android Device Administration API][1] allows enterprise administrators to
15enforce specific policies on a managed device. The system provides policies
16that control settings such as password complexity, screen lock, or camera
17availability. Developers can also augment this list with custom policies
18that control specific features within their applications. For example,
19a web browser could provide access to a whitelist of allowed domains.
20
21The list of policies exposed by an app must be specified using a file
22inside of the `res/xml` directory, using the `<restriction>` tag:
23
24```xml
25<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
26
27    <restriction
28            android:defaultValue="false"
29            android:description="@string/description_can_say_hello"
30            android:key="can_say_hello"
31            android:restrictionType="bool"
32            android:title="@string/title_can_say_hello" />
33
34</restrictions>
35```
36
37In this sample, that file can be found at
38`Application/src/main/res/xml/app_restrictions.xml`. This file must be
39also be declared inside of `ApplicationManifest.xml` using a `<meta-data>`
40element:
41
42```xml
43<meta-data
44        android:name="android.content.APP_RESTRICTIONS"
45        android:resource="@xml/app_restrictions" />
46```
47
48At runtime, the current list of restrictions enforced by policy can be
49checked by calling [RestrictionsManager.getApplicationRestrictions()][2].
50
51[1]: http://developer.android.com/guide/topics/admin/device-admin.html
52[2]: https://developer.android.com/reference/android/content/RestrictionsManager.html#getApplicationRestrictions()
53
54Pre-requisites
55--------------
56
57- Android SDK 27
58- Android Build Tools v27.0.2
59- Android Support Repository
60
61Screenshots
62-------------
63
64<img src="screenshots/main.png" height="400" alt="Screenshot"/>
65
66Getting Started
67---------------
68
69This sample uses the Gradle build system. To build this project, use the
70"gradlew build" command or use "Import Project" in Android Studio.
71
72Support
73-------
74
75- Google+ Community: https://plus.google.com/communities/105153134372062985968
76- Stack Overflow: http://stackoverflow.com/questions/tagged/android
77
78If you've found an error in this sample, please file an issue:
79https://github.com/googlesamples/android-AppRestrictionSchema
80
81Patches are encouraged, and may be submitted by forking this project and
82submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
83
84License
85-------
86
87Copyright 2017 The Android Open Source Project, Inc.
88
89Licensed to the Apache Software Foundation (ASF) under one or more contributor
90license agreements.  See the NOTICE file distributed with this work for
91additional information regarding copyright ownership.  The ASF licenses this
92file to you under the Apache License, Version 2.0 (the "License"); you may not
93use this file except in compliance with the License.  You may obtain a copy of
94the License at
95
96http://www.apache.org/licenses/LICENSE-2.0
97
98Unless required by applicable law or agreed to in writing, software
99distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
100WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
101License for the specific language governing permissions and limitations under
102the License.
103