集成Air Watch Android Studio [英] Integrating Air Watch Android Studio

查看:83
本文介绍了集成Air Watch Android Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对AirWatch Concept十分陌生,但对AirWatch的了解已经非常深入.我已经浏览了以下链接,

I am very much new to AirWatch Concept but had gone thoroughly about AirWatch. I have gone through the following links,

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

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

但徒劳.

有人可以帮助我有关Android中的Air Watch集成吗?

我到目前为止所做的事情,

Things i have done so far,

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

I have created app in the https://apidev.awmdm.com, and i have added assignemnts. The question here is, How can i get the assignment details in my android application that were added in the Air Watch Console.

我们非常感谢您的帮助.

Help is really appreciated.

更新:

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

I am able to create and push the application from AIR WATCH CONSOLE to my Device. Now, the issue i am facing is, If i am adding some application configuration in the AIR WATCH CONSOLE, i am not able to get those details in my application.

在上述情况下,我已经通过了以下网址,

I have gone through the below Url for the above scenario,

https://appconfig.org/android/ https://appconfig.org/ios/

我已经实现了上述url中提到的那些内容,但是仍然无法获得这些详细信息.如果我在任何地方出错,请让我知道.

I have implemented those things that were mentioned in the above url but still then i am not able to get those details.Please let me know if i am wrong anywhere.

我知道,在Air Watch控制台中传递的键值对将进入iOS中的com.apple.configuration.managed键.是否有人知道这些关键值对将如何出现.据我所知,它们将通过Restriction Manager处理.但是不知道如何在Android中处理.

I got to know that the key value pairs that were being passed in Air watch console will be coming into com.apple.configuration.managed key in iOS. Does any one have an idea that how these key value pairs will come. As far as i know, they will be handled via Restriction Manager. But no idea/clue how to handle in 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 方法:

oncreate Method :

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

用户列表:

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

When i am actually trying the other command:

更新:

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

Created a sample app and published to Play Store. App link as follows,

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

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

Now, its a play store app. When I am sending Application Configuration but unable to receive it in the Application. Its giving me still empty bundle from the application.

我们将不胜感激.

我们非常感谢您的帮助

推荐答案

在AirWatch资源旁边,它告诉您如何创建应用并设置应用配置,键值对以推送到设备,您需要请查看 Android限制管理器API.请按照链接中所述的步骤操作.

Beside AirWatch Resources, which tells you how you can create an app and set the app configurations,key-value pairs, to push to your devices, You need to check out Android Restriction Manager API. Follow the steps described in the link.

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

How the whole process works is, AirWatch controls AndroidForWork environment after you set your MDM as AirWatch. And then, AirWatch manages the device from AirWatch console and it pushes the App Configuration to AndroidForWork in your device. You need to implement Android Restriction Manager to access to these data passed you by your MDM. It goes same for all of the MDMs in the Market.

更新:

为了在开发阶段将应用安装到工作容器中,可以使用adb将其从Personal Container复制到Work Container.

In order to install your app into Work Container in the development phase, you can use adb to copy it from Personal Container to Work Container.

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

First, list all of the active users in the device:

./adb shell pm list users

然后,从用户列表中找到 工作用户的ID ,并在下面的命令中将其与您的应用的程序包名称和应用的主要活动"一起进行设置.

And later, find the Work User's ID from the List of Users and set it in the command below along with your app's package name and App's Main Activity.

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

该命令中的

13是工作用户的ID.就我而言,是13.

13 up there in the command is the Work User's ID. In my case, it's 13.

有关托管配置文件中的./adb命令的更多信息,请参见此链接并检查页面的最底部.

For more information about ./adb commands in Managed Profiles, see this link and check the most bottom of the page.

这篇关于集成Air Watch Android Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆