API for Android 编辑

The API for Android is based on Java. This article summarizes the Citrix Endpoint Management APIs by feature and provides the API definitions.

App management:

  • isManaged
  • isWrapped

MDX policies:

  • getPoliciesXML
  • getPolicyValue
  • setPolicyChangeMessenger

Shared vault:

  • MDXDictionary

User data:

  • getUserName

Class com.citrix.worx.sdk.MDXApplication

Methods

  • isManaged

    public static boolean isManaged (Context context)

    Checks if the app is currently managed by MDX, which means that the Citrix Secure Hub app is installed on the device and Citrix Endpoint Management policies are enforced on your app. The Endpoint Management backend infrastructure (key vaults) are queried for data encryption partial keys (secrets) which MDX will use to encrypt application file data. Returns true if the app is managed.

    Unmanaged Premium apps use the Endpoint Management policy defaults specified in Applications/Citrix/MDXToolkit/data/MDXSDK_Android/default_sdk_policies.xml. Policies are not enforced for unmanaged General apps.

    Parameters

    context – The Android context that is making this call.

    Example

    boolean bIsManaged = MDXApplication.isManaged(context);

  • isWrapped

    public static boolean isWrapped (Context context)

    Returns true if the app is wrapped with the MDX Toolkit.

    Parameters

    context – The Android context that is making this call.

    Example

    boolean bIsWrapped = MDXApplication.isWrapped(context);

  • getUserName

    public static String getUserName (Context context)

    Returns a string containing the user name of an enrolled user running an MDX-managed app, regardless of the user sign-on status. Returns nil if the user isn’t enrolled, the app isn’t managed, or the app isn’t wrapped.

    Parameters

    context – The Android context that is making this call.

    Example

    String userName = MDXApplication.getUserName(context);

Class com.citrix.worx.sdk.MDXPolicies

Methods

  • getPoliciesXML

    public static String getPoliciesXML (Context context)

    Returns the contents of default_sdk_policies.xml, as one line per policy, prefixed with (match) to indicate that the value in the XML file matches the value returned by MDXPolicies.getPolicyValue(). Returns an empty string on failure.

    Parameters

    context – The Android context that is making this call.

    Example

    String policiesXML = MDXPolicies.getPoliciesXML(context);

  • getPolicyValue

    public static String getPolicyValue (Context context, String policyName)

    Returns a String which contains current value of the named policy. Returns null if no value is found.

    Parameters

    context – The Android context that is making this call.

    policyName – The name of the policy to search for. A policy name is the value of the PolicyName element in a policy XML file.

    Example

    String value = MDXPolicies.getPolicyValue(context"DisableCamera");

  • setPolicyChangeMessenger

    public static String setPolicyChangeMessenger (Context context, String policyName. Messenger messenger)

    Registers a Messenger to receive a message when the given policy’s value changes. When MDX detects that a policy value changed in the Citrix Endpoint Management console, MDX notifies this messenger. You can then use the other APIs to re-read the policy values and change your app. Returns null.

    Parameters

    context – The Android context that is making this call.

    policyName – The policy name to monitor. A policy name is the value of the PolicyName element in a policy XML file.

    messenger – The messenger that will receive messages when the policy value changes.

    Example

    MDXPolicies.setPolicyChangeMessenger(context, "DisableCamera", messenger);

Class com.citrix.mdx.common.MDXDictionary

MDXDictionary is a container for reading and storing encrypted Android bundles of key-value pairs. Mobile productivity apps in the same MDX security group share a dictionary. Use the shared vault API to share managed content between apps that have the same MDX dictionary. For example, you can share certificates and private keys through an enrolled app so that apps can obtain a certificate from the secure vault instead of from Secure Hub.

Dictionaries are stored encrypted regardless of the Private file encryption policy and Public file encryption policy settings. Developers must unlock the vault before retrieving dictionaries.

Constructors

  • public MDXDictionary( MDXDictionary source )

    Constructs a copy of an existing MDXDictionary.

    Parameters

    source – The MDXDictionary that should be copied.

  • public MDXDictionary( String name, Bundle bundle, long sequence )

    Constructs an MDXDictionary from a name, bundle, and sequence number. If you do not know the sequence number, use the create() factory method.

    Parameters

    name – The name of the dictionary.

    bundle – The Android bundle.

    sequence – A sequence number.

Methods

  • public static MDXDictionary create( Context context, String name )

    Creates a dictionary by first checking if a dictionary with the same name already exists. If the dictionary does not exist, then a new dictionary is returned. Otherwise, the existing dictionary is returned. This method never returns null.

    Parameters

    context – The Android context that is making this call.

    name – The name of the dictionary.

    Example

    // Creates a instance of a dictionary.

    MDXDictionary dict = MDXDictionary.create(getContext(), "app-settings");

  • public static boolean delete( Context context, String name )

    Deletes a dictionary by name. Returns true on success; returns false on failure.

    Parameters

    context – The Android context that is making this call.

    name – The name of the dictionary.

    Example

    // Creates a instance of a dictionary.

    MDXDictionary.delete(getContext(), "app-settings");

  • public static MDXDictionary find( Context context, String name )

    Finds an existing dictionary. Returns an existing dictionary; returns null if no dictionary is found.

    Parameters

    context – The Android context that is making this call.

    name – The name of the dictionary.

    Example

    MDXDictionary dict = MDXDictionary.find(getContext(),"app-settings");

     if( dict != null )
         {
             // Use dictionary
         }
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:7 次

字数:8879

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文