Home | History | Annotate | only in /developers/build/prebuilts/gradle/AppRestrictionSchema
Up to higher level directory
NameDateSize
.google/10-Mar-2015
Application/10-Mar-2015
build.gradle16-Dec-201414
CONTRIB.md16-Dec-20141.6K
CONTRIBUTING.md10-Mar-20151.5K
gradle/16-Dec-2014
gradlew16-Dec-20145K
gradlew.bat16-Dec-20142.3K
LICENSE16-Dec-201411.1K
NOTICE10-Mar-2015613
README.md10-Mar-20153.6K
screenshots/10-Mar-2015
settings.gradle16-Dec-201422

README.md

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