android - 集成 Air Watch Android Studio

标签 android android-studio airwatch

我对 AirWatch Concept 非常陌生,但对 AirWatch 已经很了解了。我浏览了以下链接,

http://developer.air-watch.com/android/application-configuration-with-the-android-sdk/

http://developer.air-watch.com/android/android-sdk-setup/

但徒劳无功。

谁能帮我解决 Android 中 Air Watch 的集成问题?

到目前为止我做了什么,

我在 https://apidev.awmdm.com 中创建了应用程序,我已经添加了assignemnts。这里的问题是,如何在我的 Android 应用程序中获取已添加到 Air Watch 控制台中的分配详细信息。

非常感谢您的帮助。

更新:

我能够创建应用程序并将其从 AIR WATCH CONSOLE 推送到我的设备。现在,我面临的问题是,如果我在 AIR WATCH CONSOLE 中添加一些应用程序配置,我将无法在我的应用程序中获取这些详细信息。

对于上述场景,我已经浏览了以下 Url,

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);

用户列表:

enter image description here

当我实际尝试其他命令时:

enter image description here

更新:

创建了一个示例应用程序并发布到 Play 商店。 App链接如下,

https://play.google.com/store/apps/details?id=com.manu.samplemdm

现在,它是一个 Play 商店应用程序。当我发送应用程序配置但无法在应用程序中接收它时。它给我的应用程序包仍然是空的。

非常感谢您的帮助。

enter image description here

非常感谢您的帮助

最佳答案

除了 AirWatch 资源,它告诉您如何创建应用程序并设置应用程序配置、键值对以推送到您的设备,您需要查看 Android Restriction Manager API.按照链接中描述的步骤操作。

整个过程的工作原理是,在您将 MDM 设置为 AirWatch 后,AirWatch 控制 AndroidForWork 环境。然后,AirWatch 从 AirWatch 控制台管理设备,并将应用程序配置推送到您设备中的 AndroidForWork。您需要实现 Android 限制管理器才能访问 MDM 传递给您的这些数据。市场上的所有 MDM 都一样。

更新:

为了在开发阶段将您的应用程序安装到工作容器中,您可以使用adb将其从个人容器复制到工作容器.

首先,列出设备中的所有活跃用户:

./adb shell pm list users

稍后,从用户列表中找到工作用户的 ID,并在下面的命令中将其与您的应用程序包名称和应用程序的主 Activity 一起设置。

./adb shell am start —user 13 -n “your.apps.package.name/your.main.activity.package.name”

命令中上方的 13 是工作用户的 ID。在我的例子中,它是 13。

有关托管配置文件中 ./adb 命令的更多信息,请参阅 this link并检查页面的最底部。

关于android - 集成 Air Watch Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42112688/

相关文章:

android - React-Native : react-native-fast-image not working properly with react-native, 它给出错误

android - 没有进度对话框的加载屏幕android

android - flutter : screen not scrolling up when keyboard appears in android

android - Android Studio 3.1 中的消息窗口在哪里

android - session 'app' : Installation did not succeed. 无法安装应用程序:SHELL_UNRESPONSIVE

ios - 使用 AirWatch 部署企业 iOS 应用程序的最佳方式是什么

android - 从 android for work 应用程序访问 SD 卡数据

android tabcontentfactory 和查看加载事件

android - Webview 应用程序在第一次安装应用程序时工作,但之后只显示空白屏幕

android - Airwatch 安卓设备注册