├── LICENSE ├── README.md ├── ROADMAP.md ├── app ├── android │ ├── MDM │ │ ├── .classpath │ │ ├── .project │ │ ├── .settings │ │ │ └── org.eclipse.jdt.core.prefs │ │ ├── AndroidManifest.xml │ │ ├── bin │ │ │ ├── AndroidManifest.xml │ │ │ ├── MDM.apk │ │ │ ├── classes.dex │ │ │ ├── classes │ │ │ │ └── com │ │ │ │ │ └── osx86 │ │ │ │ │ └── mdm │ │ │ │ │ ├── BuildConfig.class │ │ │ │ │ ├── Common.class │ │ │ │ │ ├── CommonPreference.class │ │ │ │ │ ├── Constants.class │ │ │ │ │ ├── Debug.class │ │ │ │ │ ├── DevAdminManager.class │ │ │ │ │ ├── DevAdminReceiver.class │ │ │ │ │ ├── DevPolicyManager.class │ │ │ │ │ ├── EnvVar.class │ │ │ │ │ ├── GCMIntentService.class │ │ │ │ │ ├── GCMManager$1.class │ │ │ │ │ ├── GCMManager.class │ │ │ │ │ ├── MainActivity.class │ │ │ │ │ ├── Manifest$permission.class │ │ │ │ │ ├── Manifest.class │ │ │ │ │ ├── PrefKeys.class │ │ │ │ │ ├── Preference.class │ │ │ │ │ ├── R$attr.class │ │ │ │ │ ├── R$dimen.class │ │ │ │ │ ├── R$drawable.class │ │ │ │ │ ├── R$id.class │ │ │ │ │ ├── R$layout.class │ │ │ │ │ ├── R$menu.class │ │ │ │ │ ├── R$string.class │ │ │ │ │ ├── R$style.class │ │ │ │ │ ├── R$xml.class │ │ │ │ │ ├── R.class │ │ │ │ │ └── Utils.class │ │ │ ├── dexedLibs │ │ │ │ ├── android-support-v4-65451920c64bbd80c7f788367458bbbb.jar │ │ │ │ ├── gcm-c48a68d27477e80a8dd70f14cabf7583.jar │ │ │ │ └── google-play-services-46fb30d4be451be82fbdcb9cf8957378.jar │ │ │ ├── jarlist.cache │ │ │ ├── res │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ └── drawable-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ └── resources.ap_ │ │ ├── gen │ │ │ └── com │ │ │ │ └── osx86 │ │ │ │ └── mdm │ │ │ │ ├── BuildConfig.java │ │ │ │ ├── Manifest.java │ │ │ │ └── R.java │ │ ├── ic_launcher-web.png │ │ ├── libs │ │ │ ├── android-support-v4.jar │ │ │ ├── gcm.jar │ │ │ └── google-play-services.jar │ │ ├── proguard-project.txt │ │ ├── project.properties │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ └── dev_admin_manager.xml │ │ │ ├── menu │ │ │ │ └── main.xml │ │ │ ├── values-sw600dp │ │ │ │ └── dimens.xml │ │ │ ├── values-sw720dp-land │ │ │ │ └── dimens.xml │ │ │ ├── values-v11 │ │ │ │ └── styles.xml │ │ │ ├── values-v14 │ │ │ │ └── styles.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── xml │ │ │ │ └── device_admin_policies.xml │ │ └── src │ │ │ └── com │ │ │ └── osx86 │ │ │ └── mdm │ │ │ ├── Common.java │ │ │ ├── CommonPreference.java │ │ │ ├── Constants.java │ │ │ ├── Debug.java │ │ │ ├── DevAdminManager.java │ │ │ ├── DevAdminReceiver.java │ │ │ ├── DevPolicyManager.java │ │ │ ├── EnvVar.java │ │ │ ├── GCMIntentService.java │ │ │ ├── GCMManager.java │ │ │ ├── MainActivity.java │ │ │ ├── PrefKeys.java │ │ │ ├── Preference.java │ │ │ └── Utils.java │ └── README.md └── ios │ └── README.md └── control ├── apns └── README.md └── gcm ├── README.md ├── gcm.php └── instant_command /LICENSE: -------------------------------------------------------------------------------- 1 | No plan ! 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MDM 2 | === 3 | 4 | Open Source MDM(Mobile Device Management) Source, Android and iOS 5 | -------------------------------------------------------------------------------- /ROADMAP.md: -------------------------------------------------------------------------------- 1 | Roadmap 2 | 3 | 0.1 4 | ==== 5 | + Add feature notification sender source ( gcm sender, apns ) 6 | -------------------------------------------------------------------------------- /app/android/MDM/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/android/MDM/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | MDM 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/android/MDM/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /app/android/MDM/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 47 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | 70 | 71 | 72 | 73 | 74 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /app/android/MDM/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 47 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 68 | 70 | 71 | 72 | 73 | 74 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /app/android/MDM/bin/MDM.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/MDM.apk -------------------------------------------------------------------------------- /app/android/MDM/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes.dex -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/BuildConfig.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Common.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Common.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/CommonPreference.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/CommonPreference.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Constants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Constants.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Debug.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Debug.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/DevAdminManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/DevAdminManager.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/DevAdminReceiver.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/DevAdminReceiver.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/DevPolicyManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/DevPolicyManager.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/EnvVar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/EnvVar.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/GCMIntentService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/GCMIntentService.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/GCMManager$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/GCMManager$1.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/GCMManager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/GCMManager.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/MainActivity.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Manifest$permission.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Manifest$permission.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Manifest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Manifest.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/PrefKeys.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/PrefKeys.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Preference.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Preference.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$attr.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$dimen.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$drawable.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$id.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$layout.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$menu.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$string.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$style.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R$xml.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R$xml.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/R.class -------------------------------------------------------------------------------- /app/android/MDM/bin/classes/com/osx86/mdm/Utils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/classes/com/osx86/mdm/Utils.class -------------------------------------------------------------------------------- /app/android/MDM/bin/dexedLibs/android-support-v4-65451920c64bbd80c7f788367458bbbb.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/dexedLibs/android-support-v4-65451920c64bbd80c7f788367458bbbb.jar -------------------------------------------------------------------------------- /app/android/MDM/bin/dexedLibs/gcm-c48a68d27477e80a8dd70f14cabf7583.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/dexedLibs/gcm-c48a68d27477e80a8dd70f14cabf7583.jar -------------------------------------------------------------------------------- /app/android/MDM/bin/dexedLibs/google-play-services-46fb30d4be451be82fbdcb9cf8957378.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/dexedLibs/google-play-services-46fb30d4be451be82fbdcb9cf8957378.jar -------------------------------------------------------------------------------- /app/android/MDM/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /app/android/MDM/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/bin/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/bin/resources.ap_ -------------------------------------------------------------------------------- /app/android/MDM/gen/com/osx86/mdm/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.osx86.mdm; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /app/android/MDM/gen/com/osx86/mdm/Manifest.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.osx86.mdm; 9 | 10 | public final class Manifest { 11 | public static final class permission { 12 | public static final String C2D_MESSAGE="com.osx86.mdm.permission.C2D_MESSAGE"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/android/MDM/gen/com/osx86/mdm/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.osx86.mdm; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class dimen { 14 | /** Default screen margins, per the Android Design guidelines. 15 | 16 | Customize dimensions originally defined in res/values/dimens.xml (such as 17 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. 18 | 19 | */ 20 | public static final int activity_horizontal_margin=0x7f050000; 21 | public static final int activity_vertical_margin=0x7f050001; 22 | } 23 | public static final class drawable { 24 | public static final int ic_launcher=0x7f020000; 25 | } 26 | public static final class id { 27 | public static final int action_settings=0x7f090000; 28 | } 29 | public static final class layout { 30 | public static final int activity_main=0x7f030000; 31 | public static final int dev_admin_manager=0x7f030001; 32 | } 33 | public static final class menu { 34 | public static final int main=0x7f080000; 35 | } 36 | public static final class string { 37 | public static final int DEV_ADMIN_ACTIVATION_MESSAGE=0x7f060005; 38 | public static final int DEV_ADMIN_DESC=0x7f060004; 39 | public static final int DEV_ADMIN_LABEL=0x7f060003; 40 | public static final int DEV_ADMIN_STATUS_DISABLED=0x7f060008; 41 | public static final int DEV_ADMIN_STATUS_DISABLE_REQUESTED=0x7f060007; 42 | public static final int DEV_ADMIN_STATUS_ENABLED=0x7f060006; 43 | public static final int DEV_ADMIN_STATUS_PASSWD_CHANGED=0x7f060009; 44 | public static final int E_NO_GCM_REGID=0x7f06000a; 45 | public static final int GCM_CONTENT_TEXT=0x7f06000c; 46 | public static final int GCM_TITLE=0x7f06000b; 47 | public static final int action_settings=0x7f060001; 48 | public static final int app_name=0x7f060000; 49 | public static final int start_main=0x7f060002; 50 | } 51 | public static final class style { 52 | /** 53 | Base application theme, dependent on API level. This theme is replaced 54 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 55 | 56 | 57 | Theme customizations available in newer API levels can go in 58 | res/values-vXX/styles.xml, while customizations related to 59 | backward-compatibility can go here. 60 | 61 | 62 | Base application theme for API 11+. This theme completely replaces 63 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 64 | 65 | API 11 theme customizations can go here. 66 | 67 | Base application theme for API 14+. This theme completely replaces 68 | AppBaseTheme from BOTH res/values/styles.xml and 69 | res/values-v11/styles.xml on API 14+ devices. 70 | 71 | API 14 theme customizations can go here. 72 | */ 73 | public static final int AppBaseTheme=0x7f070000; 74 | /** Application theme. 75 | All customizations that are NOT specific to a particular API-level can go here. 76 | */ 77 | public static final int AppTheme=0x7f070001; 78 | } 79 | public static final class xml { 80 | public static final int device_admin_policies=0x7f040000; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/android/MDM/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/ic_launcher-web.png -------------------------------------------------------------------------------- /app/android/MDM/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/libs/android-support-v4.jar -------------------------------------------------------------------------------- /app/android/MDM/libs/gcm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/libs/gcm.jar -------------------------------------------------------------------------------- /app/android/MDM/libs/google-play-services.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/libs/google-play-services.jar -------------------------------------------------------------------------------- /app/android/MDM/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /app/android/MDM/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-18 15 | -------------------------------------------------------------------------------- /app/android/MDM/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osx86/MDM/be19272e62d5407d8d90831537a339fe3c3e552d/app/android/MDM/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/android/MDM/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/android/MDM/res/layout/dev_admin_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/android/MDM/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/android/MDM/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/android/MDM/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/android/MDM/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/android/MDM/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/android/MDM/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/android/MDM/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MDM 5 | Settings 6 | Getting Started! 7 | 8 | FreeMDM Device Admin 9 | FreeMDM Device Admin Description 10 | 11 | FreeMDM Device Admin Activation 12 | 13 | Device Admin Enabled 14 | Device Admin Disable Requested 15 | Device Admin Disabled 16 | Device Admin Password Changed 17 | 18 | There is no gcm regid 19 | Notify Message 20 | Notify Text 21 | 22 | -------------------------------------------------------------------------------- /app/android/MDM/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/android/MDM/res/xml/device_admin_policies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/Common.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.content.Context; 4 | 5 | public class Common { 6 | public static Context mCtx; 7 | public static CommonPreference mPref; 8 | } 9 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/CommonPreference.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.content.Context; 4 | 5 | class CommonPreference extends Preference 6 | { 7 | CommonPreference(Context ctx) 8 | { 9 | super(ctx); 10 | } 11 | 12 | int getAppVersion() 13 | { 14 | return mPref.getInt(PrefKeys.APP_VERSION, Constants.DEFAULT_INT_VAL); 15 | } 16 | 17 | boolean setAppVersion(int appver) 18 | { 19 | return setValue(PrefKeys.APP_VERSION, appver); 20 | } 21 | 22 | // GCM Pref 23 | String getGCMRegID() 24 | { 25 | return mPref.getString(PrefKeys.GCM_REGID, Constants.DEFAULT_STRING_VAL); 26 | } 27 | 28 | boolean setGCMRegID(String regid) 29 | { 30 | return setValue(PrefKeys.GCM_REGID, regid); 31 | } 32 | 33 | Long getRegIDExpireTime() 34 | { 35 | return mPref.getLong(PrefKeys.GCM_REGID_EXPIRE_TIME, Constants.DEFAULT_LONG_VAL); 36 | } 37 | 38 | boolean setRegIDExpireTime(Long expiretime) 39 | { 40 | return setValue(PrefKeys.GCM_REGID_EXPIRE_TIME, expiretime); 41 | } 42 | 43 | // Battery Level 44 | String getBatteryLevel() 45 | { 46 | return mPref.getString(PrefKeys.BATTERY_LEVEL, Constants.DEFAULT_STRING_VAL); 47 | } 48 | 49 | boolean setBatteryLevel(String batterylevel) 50 | { 51 | return setValue(PrefKeys.BATTERY_LEVEL, batterylevel); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/Constants.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.admin.DevicePolicyManager; 4 | import android.util.Log; 5 | 6 | 7 | public class Constants { 8 | 9 | /* 10 | * static variables 11 | */ 12 | // build level 13 | public static final int BUILD_LEVEL_RELEASE = 0x01; 14 | public static final int BUILD_LEVEL_DEBUG = 0x02; 15 | 16 | // log tags 17 | public static final String LOG_TAG = EnvVar.SOLUTION_NAME; 18 | 19 | public static final int LOG_LEVEL_VERBOSE = Log.VERBOSE; 20 | public static final int LOG_LEVEL_DEBUG = Log.DEBUG; 21 | public static final int LOG_LEVEL_INFO = Log.INFO; 22 | public static final int LOG_LEVEL_WARN = Log.WARN; 23 | public static final int LOG_LEVEL_ERROR = Log.ERROR; 24 | public static final int LOG_LEVEL_ASSERT = Log.ASSERT; 25 | 26 | // default values 27 | public static final String DEFAULT_STRING_VAL = ""; 28 | public static final int DEFAULT_INT_VAL = 0; 29 | public static final int DEFAULT_LONG_VAL = 0; 30 | 31 | public static final int STAT_DISABLED = 0; 32 | public static final int STAT_ENABLED = 1; 33 | 34 | public static final boolean TRUE = true; 35 | public static final boolean FALSE = false; 36 | 37 | // Time 38 | public static final long MS_SECOND = ( 1000L ); 39 | public static final long MS_MINUTE = ( Constants.MS_SECOND * 60L ); 40 | public static final long MS_HOUR = ( Constants.MS_MINUTE * 60L ); 41 | public static final long MS_DAY = ( Constants.MS_HOUR * 24L ); 42 | public static final long MS_WEEK = ( Constants.MS_DAY * 7L ); 43 | 44 | // gcm values 45 | public static final long GCM_EXPIRE_TIME_MS = 1000 * 3600 * 24 * 7; // 7 days 46 | 47 | 48 | 49 | // preference 50 | public static final int MAX_RETRY_PREF_COMMIT = 10; 51 | 52 | // GCM Notification Types 53 | public static final String GCM_TITLE = EnvVar.SOLUTION_NAME + "Notification"; 54 | 55 | public static final int GCM_SOUND_DEFAULT = 0x01; 56 | public static final int GCM_SOUND_RINGTONE = 0x02; 57 | 58 | public static final long[] GCM_VIBRATION_PATTERN_ONCE = {5000}; 59 | public static final long[] GCM_VIBRATION_PATTERN_SHORT = {500,500,500,500,500,500,500,500,500}; 60 | public static final long[] GCM_VIBRATION_PATTERN_LONG = {5000,5000,5000,5000,5000,5000,5000,5000,5000}; 61 | 62 | public static final int GCM_STYLE_BIGPICTURE = 0x01; 63 | public static final int GCM_STYLE_BIGTEXT = 0x02; 64 | public static final int GCM_STYLE_INBOX = 0x03; 65 | 66 | public static final String GCM_EXTRAS_MESSAGE = "msg"; 67 | public static final String GCM_EXTRAS_PROP = "prop"; 68 | public static final String GCM_EXTRAS_DEVADMIN_ACTION = "devadmin"; 69 | 70 | // Device Administrator 71 | public static final int DEV_ADMIN_REQ_CODE = 0x01; 72 | 73 | public static final int DEV_ADMIN_ACTION_CHANGE_PWD = 0x01; 74 | public static final int DEV_ADMIN_ACTION_LOCK = 0x02; 75 | public static final int DEV_ADMIN_ACTION_LOCK_PWD = 0x03; 76 | public static final int DEV_ADMIN_ACTION_WIPE = 0x04; 77 | 78 | // Device Administrator Policies 79 | public static final boolean POLICY_CAMERA_STAT_ENABLED = TRUE; 80 | public static final boolean POLICY_CAMERA_STAT_DISABLE = FALSE; 81 | 82 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_5SEC = ( MS_SECOND * 5L ); 83 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_15SEC = ( MS_SECOND * 15L ); 84 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_30SEC = ( MS_SECOND * 30L ); 85 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_1MIN = MS_MINUTE; 86 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_5MIN = ( MS_MINUTE * 5L ); 87 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_15MIN = ( MS_MINUTE * 15L ); 88 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_30MIN = ( MS_MINUTE * 30L ); 89 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK_1HOUR = MS_HOUR; 90 | 91 | public static final long POLICY_PWD_EXPIRE_TIME_30MIN = ( MS_MINUTE * 30L ); 92 | public static final long POLICY_PWD_EXPIRE_TIME_1HOUR = MS_HOUR; 93 | public static final long POLICY_PWD_EXPIRE_TIME_1DAY = MS_DAY; 94 | public static final long POLICY_PWD_EXPIRE_TIME_1WEEK = MS_WEEK; 95 | public static final long POLICY_PWD_EXPIRE_TIME_30DAY = ( MS_DAY * 30L ); 96 | public static final long POLICY_PWD_EXPIRE_TIME_365DAY = ( MS_DAY * 365L ); 97 | 98 | public static final int POLICY_PWD_HISTORY_COUNT_NEVER = 0; 99 | public static final int POLICY_PWD_HISTORY_COUNT_1 = 1; 100 | public static final int POLICY_PWD_HISTORY_COUNT_3 = 3; 101 | public static final int POLICY_PWD_HISTORY_COUNT_5 = 5; 102 | public static final int POLICY_PWD_HISTORY_COUNT_10 = 10; 103 | 104 | public static final int POLICY_PWD_MIN_LEN_NEVER = 0; 105 | public static final int POLICY_PWD_MIN_LEN = 4; 106 | public static final int POLICY_PWD_MAX_LEN = 16; 107 | 108 | public static final int POLICY_PWD_MIN_LETTER_NEVER = 0; 109 | public static final int POLICY_PWD_MIN_LOWERCASE_NEVER = 0; 110 | public static final int POLICY_PWD_MIN_NONLETTER_NEVER = 0; 111 | public static final int POLICY_PWD_MIN_NUMERIC_NEVER = 0; 112 | public static final int POLICY_PWD_MIN_SYMBOL_NEVER = 0; 113 | public static final int POLICY_PWD_MIN_UPPERCASE_NEVER = 0; 114 | 115 | public static final int POLICY_PWD_QUALITY_UNSPEICIFIED = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED; 116 | public static final int POLICY_PWD_QUALITY_SOMTHING = DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; 117 | public static final int POLICY_PWD_QUALITY_NUMERIC = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC; 118 | public static final int POLICY_PWD_QUALITY_ALPHABETIC = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC; 119 | public static final int POLICY_PWD_QUALITY_ALPHANUMERIC = DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC; 120 | public static final int POLICY_PWD_QUALITY_COMPLEX = DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; 121 | 122 | // Sync Deviceinfo 123 | public static final String SIM_STATE_UNKNOWN = "Unknown"; 124 | public static final String SIM_STATE_ABSENT = "Absent"; 125 | public static final String SIM_STATE_PIN_REQUIRED = "PIN Required"; 126 | public static final String SIM_STATE_PUK_REQUIRED = "PUK Required"; 127 | public static final String SIM_STATE_NETWORK_LOCKED = "Network Locked"; 128 | public static final String SIM_STATE_READY = "Ready"; 129 | 130 | // Defualt String, primitive values 131 | public static final String STR_NA = "N/A"; 132 | 133 | // HTTP REQUEST 134 | public static final String URL_COMMONSYNC = "commonsync"; 135 | public static final String URL_COMMONSYNC_CTRL_SYNCDATA = "syncdata"; 136 | 137 | } 138 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/Debug.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.util.Log; 4 | import android.widget.Toast; 5 | 6 | 7 | class Debug { 8 | 9 | static void log(String log) { 10 | if ( EnvVar.LOG_LEVEL == Log.VERBOSE) { 11 | Log.v( Constants.LOG_TAG, log); 12 | } 13 | else if ( EnvVar.LOG_LEVEL == Log.DEBUG) { 14 | Log.d( Constants.LOG_TAG, log); 15 | } 16 | else if ( EnvVar.LOG_LEVEL == Log.INFO) { 17 | Log.i( Constants.LOG_TAG, log); 18 | } 19 | else if ( EnvVar.LOG_LEVEL == Log.WARN) { 20 | Log.w( Constants.LOG_TAG, log); 21 | } 22 | else if ( EnvVar.LOG_LEVEL == Log.ERROR) { 23 | Log.e( Constants.LOG_TAG, log); 24 | } 25 | // else if ( EnvVar.LOG_LEVEL == Log.ASSERT ) { 26 | // } 27 | else { 28 | Log.d( Constants.LOG_TAG, log); 29 | } 30 | } 31 | 32 | static void pop(String msg) { 33 | Toast.makeText(Common.mCtx, (msg == null ? "null" : msg) , Toast.LENGTH_SHORT).show(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/DevAdminManager.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.Activity; 4 | import android.app.admin.DeviceAdminReceiver; 5 | import android.app.admin.DevicePolicyManager; 6 | import android.content.ComponentName; 7 | import android.content.Context; 8 | import android.content.Intent; 9 | import android.os.Bundle; 10 | 11 | public class DevAdminManager extends Activity { 12 | 13 | private Context mCtx; 14 | private DevicePolicyManager mDPM; 15 | private DevAdminReceiver mDAR; 16 | private ComponentName mCname; 17 | 18 | @Override 19 | public void onCreate(Bundle savedInstanceState) 20 | { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.dev_admin_manager); 23 | 24 | mCtx = getApplicationContext(); 25 | Debug.log("1.Loading Device Admin Receiver"); 26 | loadActivation(mCtx); 27 | } 28 | 29 | private void loadActivation(Context ctx) 30 | { 31 | Debug.log("Device Admin Explanation service on "); 32 | mCname = new ComponentName(this, DevAdminReceiver.class); 33 | 34 | mDPM = (DevicePolicyManager) ctx.getSystemService(Context.DEVICE_POLICY_SERVICE); 35 | 36 | if (!mDPM.isAdminActive(mCname) ) { 37 | Intent devadminIntent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); 38 | 39 | try { 40 | devadminIntent.putExtra( DevicePolicyManager.EXTRA_DEVICE_ADMIN, 41 | new ComponentName(Common.mCtx, DevAdminReceiver.class)); 42 | devadminIntent.putExtra( DevicePolicyManager.EXTRA_ADD_EXPLANATION, 43 | getResources().getString(R.string.DEV_ADMIN_ACTIVATION_MESSAGE)); 44 | 45 | startActivity(devadminIntent); 46 | }catch (Exception e) 47 | { 48 | e.printStackTrace(); 49 | } 50 | Debug.log("DeviceAdmin Activated."); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/DevAdminReceiver.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.admin.DeviceAdminReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | public class DevAdminReceiver extends DeviceAdminReceiver { 8 | 9 | @Override 10 | public void onEnabled(Context context, Intent intent) { 11 | Debug.log(context.getString(R.string.DEV_ADMIN_STATUS_ENABLED)); 12 | } 13 | 14 | @Override 15 | public CharSequence onDisableRequested(Context context, Intent intent) { 16 | return context.getString(R.string.DEV_ADMIN_STATUS_DISABLE_REQUESTED); 17 | } 18 | 19 | @Override 20 | public void onDisabled(Context context, Intent intent) { 21 | Debug.log(context.getString(R.string.DEV_ADMIN_STATUS_DISABLED)); 22 | } 23 | 24 | @Override 25 | public void onPasswordChanged(Context context, Intent intent) { 26 | Debug.pop(context.getString(R.string.DEV_ADMIN_STATUS_PASSWD_CHANGED)); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/DevPolicyManager.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.admin.DevicePolicyManager; 4 | import android.content.ComponentName; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | 8 | public class DevPolicyManager { 9 | 10 | private Context mCtx; 11 | private DevicePolicyManager mDPM; 12 | private ComponentName mCname; 13 | 14 | DevPolicyManager(Context ctx) 15 | { 16 | mCtx = ctx; 17 | mDPM = (DevicePolicyManager)ctx.getSystemService(Context.DEVICE_POLICY_SERVICE); 18 | mCname= new ComponentName(ctx, DevAdminReceiver.class); 19 | Debug.log("Initialized Device Policy Manager"); 20 | init(); 21 | } 22 | 23 | public void init() 24 | { 25 | DevicePolicyManager mDPM = (DevicePolicyManager) mCtx.getSystemService(Context.DEVICE_POLICY_SERVICE); 26 | 27 | if (!mDPM.isAdminActive(mCname) ) { 28 | Debug.log("Activating DeviceAdmin."); 29 | 30 | Intent intent = new Intent(Common.mCtx, DevAdminManager.class); 31 | mCtx.startActivity(intent); 32 | } 33 | } 34 | 35 | public void lockDevice() 36 | { 37 | try { 38 | mDPM.lockNow(); 39 | } 40 | catch(Exception e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | /* 46 | * option : 0, WIPE_EXTERNAL_STORAGE 47 | * 48 | */ 49 | public void wipeDevice(int option) 50 | { 51 | if ( option != 0 && option != DevicePolicyManager.WIPE_EXTERNAL_STORAGE ) { 52 | option = 0; 53 | } 54 | 55 | try { 56 | mDPM.wipeData(option); 57 | } 58 | catch(Exception e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | 63 | /* 64 | * API Level 14 65 | * flag : true = disable, false = enable 66 | */ 67 | public void setDisableCamera(boolean flag) 68 | { 69 | try { 70 | mDPM.setCameraDisabled(mCname, flag); 71 | } 72 | catch(Exception e) { 73 | e.printStackTrace(); 74 | } 75 | } 76 | 77 | /* 78 | * pwd : new password 79 | * option : 0, RESET_PASSWORD_REQUIRE_ENTRY( other admin cannot change password ) 80 | * 81 | */ 82 | public void resetPassword(String pwd, int option) 83 | { 84 | boolean result = false; 85 | if ( option != 0 && option != DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY ) { 86 | option = DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY; 87 | } 88 | 89 | try { 90 | result = mDPM.resetPassword(pwd, option); 91 | } 92 | catch(Exception e) { 93 | e.printStackTrace(); 94 | Debug.pop("[Exception] Failed to resetPassword"); 95 | } 96 | 97 | if ( result ) { 98 | Debug.pop("resetPassword - Successfully Done"); 99 | }else { 100 | Debug.pop("Failed to resetPassword"); 101 | } 102 | } 103 | 104 | /* 105 | * num : fail count for wipe 106 | */ 107 | public void setMaxFailPasswordForWipe(int num) 108 | { 109 | if (num <= 0 ) { 110 | num = EnvVar.POLICY_PWD_MAX_FAIL_FOR_WIPE; 111 | } 112 | 113 | try { 114 | mDPM.setMaximumFailedPasswordsForWipe(mCname, num); 115 | } 116 | catch(Exception e) { 117 | e.printStackTrace(); 118 | } 119 | } 120 | 121 | public void setMaxTimeToLock(long ms) 122 | { 123 | if (ms <= 0 ) { 124 | ms = EnvVar.POLICY_PWD_MAX_TIME_TO_LOCK; 125 | } 126 | 127 | try { 128 | mDPM.setMaximumTimeToLock(mCname, ms); 129 | } 130 | catch(Exception e) { 131 | e.printStackTrace(); 132 | } 133 | } 134 | 135 | 136 | public void setPasswordExpirationTime(long ms) 137 | { 138 | if (ms <= 0 ) { 139 | ms = EnvVar.POLICY_PWD_EXPIRE_TIME; 140 | } 141 | 142 | try { 143 | mDPM.setPasswordExpirationTimeout(mCname, ms); 144 | } 145 | catch(Exception e) { 146 | e.printStackTrace(); 147 | } 148 | } 149 | 150 | 151 | public void setPasswordHistoryCount(int num) 152 | { 153 | if (num < 0 ) { 154 | num = EnvVar.POLICY_PWD_HISTORY_COUNT; 155 | } 156 | 157 | try { 158 | mDPM.setPasswordHistoryLength(mCname, num); 159 | } 160 | catch(Exception e) { 161 | e.printStackTrace(); 162 | } 163 | } 164 | 165 | public void setPasswordMinLen(int len) 166 | { 167 | if (len < 0 ) { 168 | len = EnvVar.POLICY_PWD_MIN_LEN; 169 | } 170 | 171 | try { 172 | mDPM.setPasswordMinimumLength(mCname, len); 173 | } 174 | catch(Exception e) { 175 | e.printStackTrace(); 176 | } 177 | 178 | } 179 | 180 | public void setPasswordMinLetter(int num) 181 | { 182 | if (num < 0 ) { 183 | num = EnvVar.POLICY_PWD_MIN_LETTER; 184 | } 185 | 186 | try { 187 | mDPM.setPasswordMinimumLetters(mCname, num); 188 | } 189 | catch(Exception e) { 190 | e.printStackTrace(); 191 | } 192 | } 193 | 194 | public void setPasswordMinLowerCase(int num) 195 | { 196 | if (num < 0 ) { 197 | num = EnvVar.POLICY_PWD_MIN_LOWERCASE; 198 | } 199 | 200 | try { 201 | mDPM.setPasswordMinimumLowerCase(mCname, num); 202 | } 203 | catch(Exception e) { 204 | e.printStackTrace(); 205 | } 206 | } 207 | 208 | 209 | public void setPasswordMinNonLetter(int num) 210 | { 211 | if (num < 0 ) { 212 | num = EnvVar.POLICY_PWD_MIN_NONLETTER; 213 | } 214 | 215 | try { 216 | mDPM.setPasswordMinimumNonLetter(mCname, num); 217 | } 218 | catch(Exception e) { 219 | e.printStackTrace(); 220 | } 221 | } 222 | 223 | 224 | public void setPasswordMinNumeric(int num) 225 | { 226 | if (num < 0 ) { 227 | num = EnvVar.POLICY_PWD_MIN_NUMERIC; 228 | } 229 | 230 | try { 231 | mDPM.setPasswordMinimumNumeric(mCname, num); 232 | } 233 | catch(Exception e) { 234 | e.printStackTrace(); 235 | } 236 | } 237 | 238 | public void setPasswordMinSymbol(int num) 239 | { 240 | if (num < 0 ) { 241 | num = EnvVar.POLICY_PWD_MIN_SYMBOL; 242 | } 243 | 244 | try { 245 | mDPM.setPasswordMinimumSymbols(mCname, num); 246 | } 247 | catch(Exception e) { 248 | e.printStackTrace(); 249 | } 250 | } 251 | 252 | public void setPasswordMinUpperCase(int num) 253 | { 254 | if (num < 0 ) { 255 | num = EnvVar.POLICY_PWD_MIN_UPPERCASE; 256 | } 257 | 258 | try { 259 | mDPM.setPasswordMinimumUpperCase(mCname, num); 260 | } 261 | catch(Exception e) { 262 | e.printStackTrace(); 263 | } 264 | } 265 | 266 | public void setPasswordQuality(int quality) 267 | { 268 | if (quality < 0 ) { 269 | quality = EnvVar.POLICY_PWD_MIN_UPPERCASE; 270 | } 271 | 272 | try { 273 | mDPM.setPasswordQuality(mCname, quality); 274 | } 275 | catch(Exception e) { 276 | e.printStackTrace(); 277 | } 278 | } 279 | 280 | public void setStorageEncrypt(boolean encrypt) 281 | { 282 | int result = 0; 283 | try { 284 | result = mDPM.getStorageEncryptionStatus(); 285 | if ( result == DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED ) { 286 | Debug.pop("Failed to Encrypt Storage - UnSupported"); 287 | return; 288 | }else if ( result == DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE ) { 289 | Debug.pop("Failed to Encrypt Storage - InActive"); 290 | return; 291 | }else if ( result == DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED ) { 292 | Debug.pop("Failed to Encrypt Storage - UnSupported"); 293 | return; 294 | }else { 295 | Debug.pop("Ready to Encrypt Storage."); 296 | } 297 | 298 | result = mDPM.setStorageEncryption(mCname, encrypt); 299 | } 300 | catch(Exception e) { 301 | e.printStackTrace(); 302 | } 303 | } 304 | 305 | 306 | // Warning Policy : http://developer.android.com/reference/android/app/admin/DevicePolicyManager.html 307 | 308 | } 309 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/EnvVar.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.Notification; 4 | import android.support.v4.app.NotificationCompat.Style; 5 | 6 | @SuppressWarnings("unused") 7 | public class EnvVar { 8 | 9 | /* 10 | * variables 11 | */ 12 | public static final String DEFAULT_PROTOCOL = "http"; 13 | public static final String SERVER_DOMAIN = "mdm.libeasy.com"; 14 | public static final String SERVER_URL = DEFAULT_PROTOCOL + "://" + SERVER_DOMAIN; 15 | 16 | public static final String SOLUTION_NAME = "MDM"; 17 | public static final String GCM_SENDER_ID = ""; 18 | 19 | // gcm 20 | public static final int GCM_SOUND = Constants.GCM_SOUND_DEFAULT; 21 | public static final long[] GCM_VIBRATION = Constants.GCM_VIBRATION_PATTERN_LONG; 22 | public static final int GCM_STYLE = Constants.GCM_STYLE_BIGPICTURE; 23 | 24 | // release 25 | public static final int RELEASE_LOG = Constants.LOG_LEVEL_WARN; 26 | public static final int DEBUG_LOG = Constants.LOG_LEVEL_DEBUG; 27 | 28 | // debug 29 | public static final int BUILD_LEVEL = Constants.BUILD_LEVEL_RELEASE; 30 | public static final int LOG_LEVEL = BUILD_LEVEL == Constants.BUILD_LEVEL_RELEASE ? RELEASE_LOG : BUILD_LEVEL == Constants.BUILD_LEVEL_DEBUG ? DEBUG_LOG : null; 31 | 32 | // device policy 33 | public static final boolean POLICY_CAMERA_STAT = Constants.POLICY_CAMERA_STAT_ENABLED; 34 | 35 | public static final int POLICY_PWD_MAX_FAIL_FOR_WIPE = 50; 36 | public static final long POLICY_PWD_MAX_TIME_TO_LOCK = Constants.POLICY_PWD_MAX_TIME_TO_LOCK_15SEC; 37 | public static final long POLICY_PWD_EXPIRE_TIME = Constants.POLICY_PWD_EXPIRE_TIME_30MIN; 38 | public static final int POLICY_PWD_HISTORY_COUNT = Constants.POLICY_PWD_HISTORY_COUNT_10; 39 | public static final int POLICY_PWD_MIN_LEN = Constants.POLICY_PWD_MIN_LEN; 40 | public static final int POLICY_PWD_MIN_LETTER = Constants.POLICY_PWD_MIN_LETTER_NEVER; 41 | public static final int POLICY_PWD_MIN_LOWERCASE = Constants.POLICY_PWD_MIN_LOWERCASE_NEVER; 42 | public static final int POLICY_PWD_MIN_NONLETTER = Constants.POLICY_PWD_MIN_NONLETTER_NEVER; 43 | public static final int POLICY_PWD_MIN_NUMERIC = Constants.POLICY_PWD_MIN_NUMERIC_NEVER; 44 | public static final int POLICY_PWD_MIN_SYMBOL = Constants.POLICY_PWD_MIN_SYMBOL_NEVER; 45 | public static final int POLICY_PWD_MIN_UPPERCASE = Constants.POLICY_PWD_MIN_UPPERCASE_NEVER; 46 | public static final int POLICY_PWD_QUALITY_NUMERIC = Constants.POLICY_PWD_QUALITY_NUMERIC; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/GCMIntentService.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.Notification; 4 | import android.app.NotificationManager; 5 | import android.app.PendingIntent; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.media.RingtoneManager; 9 | import android.net.Uri; 10 | import android.support.v4.app.NotificationCompat; 11 | import android.support.v4.app.NotificationCompat.Style; 12 | import android.support.v4.app.TaskStackBuilder; 13 | 14 | import com.google.android.gcm.GCMBaseIntentService; 15 | 16 | public class GCMIntentService extends GCMBaseIntentService { 17 | 18 | private Uri notisound; 19 | private Style notistyle; 20 | private long[] notivib; 21 | 22 | private int mMsgid = 0; 23 | 24 | public GCMIntentService() { 25 | super(EnvVar.GCM_SENDER_ID); 26 | init(); 27 | } 28 | 29 | @SuppressWarnings("unused") 30 | private void init() { 31 | Debug.log("Initializing GCM Style..."); 32 | 33 | if ( EnvVar.GCM_SOUND == Constants.GCM_SOUND_DEFAULT ) { 34 | notisound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 35 | }else if (EnvVar.GCM_SOUND == Constants.GCM_SOUND_RINGTONE ) { 36 | notisound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); 37 | }else { 38 | notisound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 39 | } 40 | 41 | if ( EnvVar.GCM_STYLE == Constants.GCM_STYLE_BIGPICTURE ) { 42 | notistyle = new NotificationCompat.BigPictureStyle(); 43 | }else if ( EnvVar.GCM_STYLE == Constants.GCM_STYLE_BIGTEXT ) { 44 | notistyle = new NotificationCompat.BigTextStyle(); 45 | }else if ( EnvVar.GCM_STYLE == Constants.GCM_STYLE_INBOX ) { 46 | notistyle = new NotificationCompat.InboxStyle(); 47 | } 48 | 49 | notivib = EnvVar.GCM_VIBRATION; 50 | } 51 | 52 | 53 | @Override 54 | protected void onError(Context arg0, String arg1) { 55 | Debug.log("GCMIntentService Error : " + arg1 ); 56 | } 57 | 58 | 59 | @Override 60 | protected void onMessage(Context arg0, Intent arg1) { 61 | 62 | String notifymsg = arg1.getExtras().getString(Constants.GCM_EXTRAS_MESSAGE); 63 | Debug.log("GCMIntentService notify message : " + notifymsg); 64 | 65 | if ( notifymsg != null ) { 66 | NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) 67 | .setSmallIcon(R.drawable.ic_launcher) 68 | .setContentTitle("MDM Notification") 69 | .setSound(notisound) 70 | .setVibrate(notivib) 71 | .setStyle(notistyle) 72 | .setContentText(notifymsg); 73 | 74 | // Creates an explicit intent for an Activity in your app 75 | Intent resultIntent = new Intent(this, MainActivity.class); 76 | 77 | TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); 78 | stackBuilder.addParentStack(MainActivity.class); 79 | stackBuilder.addNextIntent(resultIntent); 80 | PendingIntent resultPendingIntent = stackBuilder.getPendingIntent( 81 | 0, 82 | PendingIntent.FLAG_UPDATE_CURRENT 83 | ); 84 | 85 | mBuilder.setContentIntent(resultPendingIntent); 86 | NotificationManager mNotificationManager = 87 | (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 88 | 89 | mNotificationManager.notify(mMsgid, mBuilder.build()); 90 | new DevPolicyManager(arg0).setDisableCamera(false); 91 | } 92 | } 93 | 94 | @Override 95 | protected void onRegistered(Context arg0, String arg1) { 96 | Debug.log("GCMIntentService Registered : " + arg1 ); 97 | } 98 | 99 | @Override 100 | protected void onUnregistered(Context arg0, String arg1) { 101 | Debug.log("GCMIntentService Unregistered : " + arg1 ); 102 | 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/GCMManager.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | 4 | 5 | import java.io.IOException; 6 | import java.sql.Timestamp; 7 | 8 | import android.app.Activity; 9 | import android.content.Context; 10 | import android.os.AsyncTask; 11 | 12 | import com.google.android.gms.gcm.GoogleCloudMessaging; 13 | 14 | 15 | class GCMManager extends Activity { 16 | GoogleCloudMessaging gcm; 17 | 18 | private CommonPreference mPref; 19 | private Context mCtx; 20 | private String mRegid; 21 | 22 | GCMManager(Context ctx) { 23 | mCtx = ctx; 24 | if ( Common.mPref == null ) { 25 | Common.mPref = new CommonPreference(mCtx); 26 | } 27 | 28 | mPref = Common.mPref; 29 | init(mCtx); 30 | } 31 | 32 | private void init(Context ctx) 33 | { 34 | 35 | mRegid = getRegistrationId(mCtx); 36 | 37 | // if (mRegid.length() == 0) { 38 | registerBackground(); 39 | //} 40 | 41 | gcm = GoogleCloudMessaging.getInstance(mCtx); 42 | Debug.log("[End of 1]. Regid :" + mRegid); 43 | } 44 | 45 | public String getRegistrationId(Context context) { 46 | 47 | String regid = ""; 48 | 49 | try 50 | { 51 | regid = mPref.getGCMRegID(); 52 | Debug.log("1-1. GCM REGID : " + regid ); 53 | if ( regid.length() == 0 ) { 54 | Debug.log("1-1. NO GCM REGID : " + mCtx.getString(R.string.E_NO_GCM_REGID) ); 55 | return ""; 56 | } 57 | 58 | // check if app was updated; 59 | int regver = mPref.getAppVersion(); 60 | int curver = Utils.getAppVersion(mCtx); 61 | 62 | Debug.log("1-2. Appversion : " + curver + ", Regver :" + regver); 63 | if ( regver != curver || isRegistrationExpired() ) { 64 | Debug.log("1-2. App version changed or registration expired"); 65 | return ""; 66 | } 67 | 68 | }catch(Exception e){} 69 | 70 | return regid; 71 | } 72 | 73 | private void setRegistrationId(Context context, String regid) { 74 | int appver = Utils.getAppVersion(context); 75 | long expiretime = System.currentTimeMillis() + Constants.GCM_EXPIRE_TIME_MS; 76 | 77 | Debug.log("Saving registration id on app version : " + appver); 78 | try { 79 | if ( regid != null ) { 80 | Debug.log("registration id : " + regid); 81 | mPref.setGCMRegID(regid); 82 | } 83 | mPref.setAppVersion(appver); 84 | Debug.log("Setting registration expiry time to " + new Timestamp(expiretime) ); 85 | 86 | mPref.setRegIDExpireTime(expiretime); 87 | 88 | }catch(Exception e) 89 | { 90 | e.printStackTrace(); 91 | } 92 | 93 | 94 | } 95 | 96 | private boolean isRegistrationExpired() { 97 | long expiretime = mPref.getRegIDExpireTime(); 98 | return System.currentTimeMillis() > expiretime; 99 | } 100 | 101 | /** 102 | * Registers the application with GCM servers asynchronously. 103 | *

104 | * Stores the registration id, app versionCode, and expiration time in the 105 | * application's shared preferences. 106 | */ 107 | 108 | 109 | private void registerBackground() { 110 | new AsyncTask() { 111 | @Override 112 | protected String doInBackground(Void... params) { 113 | Debug.log("*** Starting registerBackground Task "); 114 | 115 | String msg = ""; 116 | try { 117 | if (gcm == null) { 118 | gcm = GoogleCloudMessaging.getInstance(mCtx); 119 | } 120 | mRegid = gcm.register(EnvVar.GCM_SENDER_ID); 121 | msg = "Device registered, registration id=" + mRegid; 122 | Debug.log(msg); 123 | 124 | // Save the regid - no need to register again. 125 | setRegistrationId(mCtx, mRegid); 126 | } catch (IOException ex) { 127 | msg = "Error :" + ex.getMessage(); 128 | } 129 | return msg; 130 | } 131 | 132 | protected void onPostExecute(String msg) { 133 | Debug.log(msg + "\n"); 134 | } 135 | 136 | }.execute(); 137 | } 138 | 139 | 140 | public void sendGCM() { 141 | } 142 | 143 | 144 | } 145 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.app.Activity; 4 | import android.app.admin.DevicePolicyManager; 5 | import android.content.ComponentName; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | import android.os.Bundle; 9 | import android.view.Menu; 10 | 11 | public class MainActivity extends Activity { 12 | private Context mCtx; 13 | private GCMManager mGCM; 14 | private CommonPreference mPref; 15 | private boolean thread_flag_datasync; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_main); 21 | 22 | mCtx = getApplicationContext(); 23 | if ( Common.mPref == null ) { 24 | Common.mPref = new CommonPreference(mCtx); 25 | } 26 | mPref = Common.mPref; 27 | 28 | if ( Common.mCtx == null ) { 29 | Common.mCtx = mCtx; 30 | } 31 | init(); 32 | } 33 | 34 | 35 | @Override 36 | public boolean onCreateOptionsMenu(Menu menu) { 37 | // Inflate the menu; this adds items to the action bar if it is present. 38 | getMenuInflater().inflate(R.menu.main, menu); 39 | return true; 40 | } 41 | 42 | 43 | public boolean init() { 44 | thread_flag_datasync = false; 45 | 46 | 47 | if ( mPref.getGCMRegID() != null ) { 48 | Debug.log("stored registration id : " + mPref.getGCMRegID() ); 49 | } 50 | Debug.log("Loading GCMManager..."); 51 | 52 | mGCM = new GCMManager(mCtx); 53 | 54 | // activate device administration 55 | ComponentName mCname = new ComponentName(this, DevAdminReceiver.class); 56 | DevicePolicyManager mDPM = (DevicePolicyManager) mCtx.getSystemService(Context.DEVICE_POLICY_SERVICE); 57 | 58 | if (!mDPM.isAdminActive(mCname) ) { 59 | Debug.log("Activating DeviceAdmin."); 60 | 61 | Intent intent = new Intent(this, DevAdminManager.class); 62 | startActivity(intent); 63 | } 64 | 65 | // sync new device info 66 | if ( thread_flag_datasync == false ) { 67 | new Thread(new Runnable() { 68 | public void run() { 69 | new DataSync(mCtx).syncdata(); 70 | } 71 | }).start(); 72 | thread_flag_datasync = true; 73 | } 74 | 75 | Debug.log("Now Syncing New Device Information. "); 76 | 77 | 78 | return true; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/PrefKeys.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | class PrefKeys 4 | { 5 | public static final String APP_VERSION = "0x00000001"; 6 | public static final String GCM_REGID = "0x00000002"; 7 | public static final String GCM_REGID_EXPIRE_TIME = "0x00000003"; 8 | public static final String BATTERY_LEVEL = "0x00000004"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/Preference.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.content.SharedPreferences.Editor; 6 | import android.content.SharedPreferences.OnSharedPreferenceChangeListener; 7 | import android.preference.PreferenceManager; 8 | 9 | class Preference 10 | { 11 | protected SharedPreferences mPref; 12 | 13 | protected Preference(Context ctx) 14 | { 15 | mPref = PreferenceManager.getDefaultSharedPreferences(ctx); 16 | } 17 | 18 | protected synchronized boolean setValue(String key, Object value) 19 | { 20 | if ( value == null ) 21 | { 22 | return false; 23 | } 24 | 25 | Editor editor = mPref.edit(); 26 | 27 | if ( value instanceof Boolean ) 28 | { 29 | editor.putBoolean(key, (Boolean)value); 30 | } 31 | else if ( value instanceof Integer ) 32 | { 33 | editor.putInt(key, (Integer)value); 34 | } 35 | else if ( value instanceof Long) 36 | { 37 | editor.putLong(key, (Long)value); 38 | } 39 | else if ( value instanceof Float ) 40 | { 41 | editor.putFloat(key, (Float)value); 42 | } 43 | else if ( value instanceof String ) 44 | { 45 | editor.putString(key, (String)value); 46 | } 47 | else { 48 | return false; 49 | } 50 | 51 | int retry; 52 | for ( retry = 0; retry < Constants.MAX_RETRY_PREF_COMMIT && !editor.commit();) { 53 | retry++; 54 | } 55 | 56 | return retry < Constants.MAX_RETRY_PREF_COMMIT; 57 | } 58 | 59 | 60 | void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) 61 | { 62 | mPref.registerOnSharedPreferenceChangeListener(listener); 63 | } 64 | 65 | void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener) 66 | { 67 | mPref.unregisterOnSharedPreferenceChangeListener(listener); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/android/MDM/src/com/osx86/mdm/Utils.java: -------------------------------------------------------------------------------- 1 | package com.osx86.mdm; 2 | 3 | import android.content.Context; 4 | import android.content.pm.PackageInfo; 5 | import android.content.pm.PackageManager.NameNotFoundException; 6 | 7 | public class Utils { 8 | 9 | static int getAppVersion(Context context) { 10 | try { 11 | PackageInfo packageInfo = context.getPackageManager() 12 | .getPackageInfo(context.getPackageName(), 0); 13 | return packageInfo.versionCode; 14 | } catch (NameNotFoundException e) { 15 | // should never happen 16 | throw new RuntimeException("Could not get package name: " + e); 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/android/README.md: -------------------------------------------------------------------------------- 1 | android app 2 | =========== 3 | MDM for android app 4 | -------------------------------------------------------------------------------- /app/ios/README.md: -------------------------------------------------------------------------------- 1 | iOS App 2 | ======= 3 | MDM for iOS App 4 | -------------------------------------------------------------------------------- /control/apns/README.md: -------------------------------------------------------------------------------- 1 | apns sender 2 | =========== 3 | 4 | Apple iOS Notification sender 5 | -------------------------------------------------------------------------------- /control/gcm/README.md: -------------------------------------------------------------------------------- 1 | gcm sender 2 | ========== 3 | 4 | send gcm notification 5 | -------------------------------------------------------------------------------- /control/gcm/gcm.php: -------------------------------------------------------------------------------- 1 | 98 | -------------------------------------------------------------------------------- /control/gcm/instant_command: -------------------------------------------------------------------------------- 1 | 1. Curl 2 | # api_key=YOUR_API_KEY 3 | 4 | # curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}" 5 | --------------------------------------------------------------------------------