【发布时间】:2017-02-08 12:07:08
【问题描述】:
我对 AirWatch 概念非常陌生,但对 AirWatch 的了解非常透彻。我浏览了以下链接,
http://developer.air-watch.com/android/application-configuration-with-the-android-sdk/
http://developer.air-watch.com/android/android-sdk-setup/
但徒劳无功。
谁能帮助我了解如何将 Air Watch 集成到 Android 中?
到目前为止我做过的事情,
我在https://apidev.awmdm.com 中创建了应用程序,并添加了assignemnts。这里的问题是,我如何才能在我的 Android 应用程序中获取在 Air Watch 控制台中添加的分配详细信息。
非常感谢您的帮助。
更新:
我能够创建应用程序并将其从 AIR WATCH CONSOLE 推送到我的设备。现在,我面临的问题是,如果我在 AIR WATCH CONSOLE 中添加一些应用程序配置,我无法在我的应用程序中获取这些详细信息。
对于上述场景,我已经浏览了以下网址,
https://appconfig.org/android/ 与https://appconfig.org/ios/ 非常相似
我已经实现了上面 url 中提到的那些东西,但我仍然无法获得这些细节。如果我在任何地方错了,请告诉我。
我知道在 Air watch 控制台中传递的键值对将进入 iOS 中的 com.apple.configuration.managed 键。有没有人知道这些键值对将如何出现。据我所知,他们将通过Restriction Manager 处理。但不知道/不知道如何在 Android 中处理。
更新:
xml/app_restrictions.xml:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<restriction
android:key="ManagedServer"
android:restrictionType="string"
android:title="Managed Server"
tools:ignore="ValidRestrictions" />
<restriction
android:key="@string/mdm_key_managed_server_name"
android:restrictionType="string"
android:title="@string/mdm_key_managed_server_url"
tools:ignore="ValidRestrictions" />
<restriction
android:key="@string/mdm_key_managed_server_url"
android:restrictionType="string"
android:title="@string/mdm_key_managed_server_url"
tools:ignore="ValidRestrictions" />
</restrictions>
oncreate 方法:
IntentFilter restrictionsFilter =
new IntentFilter(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
BroadcastReceiver restrictionsReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Get the current configuration bundle
Bundle appRestrictions = myRestrictionsMgr.getApplicationRestrictions();
// Check current configuration settings, change your app's UI and
// functionality as necessary.
Toast.makeText(LoginActivity.this, "Reciever Called", Toast.LENGTH_LONG).show();
RestrictionsManager myRestrictionsMgr =
(RestrictionsManager)
getSystemService(Context.RESTRICTIONS_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
if (myRestrictionsMgr != null) {
Bundle appRestrictions = myRestrictionsMgr.getApplicationRestrictions();
if (appRestrictions != null) {
if (appRestrictions.containsKey("ManagedServer")) {
String mConfigDetails = appRestrictions.getString("Managed Server");
Toast.makeText(LoginActivity.this, "" + mConfigDetails, Toast.LENGTH_LONG).show();
}
}
}
}
}
};
registerReceiver(restrictionsReceiver, restrictionsFilter);
用户列表:
当我实际尝试其他命令时:
更新:
创建了一个示例应用并发布到 Play 商店。应用链接如下,
https://play.google.com/store/apps/details?id=com.manu.samplemdm
现在,它是一个 Play 商店应用。当我发送应用程序配置但无法在应用程序中接收它时。它给了我应用程序中的空包。
非常感谢您的帮助。
非常感谢您的帮助
【问题讨论】:
标签: android android-studio airwatch