1 2Android DeviceOwner Sample 3=================================== 4 5This sample demonstrates how to use some device owner features. As a device owner, you can configure 6global settings such as automatic time and timezone. You can mandate a specific launcher by 7preferred intent handler. 8 9Introduction 10------------ 11 12In order to set global settings, use [DevicePolicyManager#setGlobalSetting][1] and specify one of 13the [Settings.Global][2] keys available. Note that you need to specify its value as a String. As 14most of the keys accept boolean values, you will mostly use "1" for true and "0" for false. 15 16You can mandate a specific launcher by adding a persistent preferred activity for an IntentFilter 17with Intent.CATEGORY_HOME category. Call [DevicePolicyManager#addPersistentPreferredActivity][3] to 18register the activity. You can clear the registration with 19[clearPackagePersistentPreferredActivities][4]. 20 21As a device owner, you can also use the features available for managed profile owner. See 22[BasicManagedProfile][5]. 23 24[1]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String) 25[2]: http://developer.android.com/reference/android/provider/Settings.Global.html 26[3]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#addPersistentPreferredActivity(android.content.ComponentName, android.content.IntentFilter, android.content.ComponentName) 27[4]: http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html#clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String) 28[5]: https://developer.android.com/samples/BasicManagedProfile/index.html 29 30Pre-requisites 31-------------- 32 33- Android SDK 27 34- Android Build Tools v27.0.2 35- Android Support Repository 36 37Screenshots 38------------- 39 40<img src="screenshots/1-main.png" height="400" alt="Screenshot"/> 41 42Getting Started 43--------------- 44 45This sample uses the Gradle build system. To build this project, use the 46"gradlew build" command or use "Import Project" in Android Studio. 47 48Support 49------- 50 51- Google+ Community: https://plus.google.com/communities/105153134372062985968 52- Stack Overflow: http://stackoverflow.com/questions/tagged/android 53 54If you've found an error in this sample, please file an issue: 55https://github.com/googlesamples/android-DeviceOwner 56 57Patches are encouraged, and may be submitted by forking this project and 58submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 59 60License 61------- 62 63Copyright 2017 The Android Open Source Project, Inc. 64 65Licensed to the Apache Software Foundation (ASF) under one or more contributor 66license agreements. See the NOTICE file distributed with this work for 67additional information regarding copyright ownership. The ASF licenses this 68file to you under the Apache License, Version 2.0 (the "License"); you may not 69use this file except in compliance with the License. You may obtain a copy of 70the License at 71 72http://www.apache.org/licenses/LICENSE-2.0 73 74Unless required by applicable law or agreed to in writing, software 75distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 76WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 77License for the specific language governing permissions and limitations under 78the License. 79