public final class

MAMPolicyManager

extends Object
java.lang.Object
   ↳ com.microsoft.intune.mam.client.identity.MAMPolicyManager

Class Overview

Allows multi-identity apps to specify the current identity, which will determine the active policy. Allows all apps to retrieve the active policy, or the policy for a specific identity.

Summary

Public Methods
static void bypassConditionalLaunchChecks(Activity activity)
Allow the given Activity to bypass conditional launch checks.
static String getCurrentIdentity(Context context)
This method is deprecated. Use getCurrentIdentityOID(Context).
static String getCurrentIdentityOID(Context context)
Computes the current effective identity that will be used for policy and returns its AAD OID.
static String getCurrentThreadIdentity()
This method is deprecated. Use getCurrentThreadIdentityOID().
static String getCurrentThreadIdentityOID()
Get the AAD OID of the current thread identity.
static AppPolicy getCurrentThreadPolicy()
Get the current app policy.
static boolean getIsIdentityManaged(String identity)
This method is deprecated. Use getIsIdentityOIDManaged(String).
static boolean getIsIdentityOIDManaged(String oid)
static AppPolicy getPolicy(Context context)
Get the current app policy.
static AppPolicy getPolicy()
This method is deprecated. Use getCurrentThreadPolicy().
static AppPolicy getPolicyForIdentity(String identity)
This method is deprecated. Use getPolicyForIdentityOID(String).
static AppPolicy getPolicyForIdentityOID(String oid)
Get the applicable app policy for a given identity.
static String getProcessIdentity()
This method is deprecated. Use getProcessIdentityOID().
static String getProcessIdentityOID()
Get the AAD OID of the process-wide identity.
static String getUIPolicyIdentity(Context context)
This method is deprecated. Use getUIPolicyIdentityOID(Context).
static String getUIPolicyIdentityOID(Context context)
Get the AAD OID of the current UI identity.
static MAMIdentitySwitchResult setCurrentThreadIdentity(String identity)
This method is deprecated. Use setCurrentThreadIdentityOID(String).
static MAMIdentitySwitchResult setCurrentThreadIdentityOID(String oid)
Set the current thread identity.
static MAMIdentitySwitchResult setProcessIdentity(String identity)
This method is deprecated. Use setProcessIdentityOID(String).
static MAMIdentitySwitchResult setProcessIdentityOID(String oid)
Set the process-wide identity.
static void setUIPolicyIdentity(Context context, String identity, MAMSetUIIdentityCallback mamSetUIIdentityCallback)
static void setUIPolicyIdentity(Context context, String identity, MAMSetUIIdentityCallback mamSetUIIdentityCallback, EnumSet<IdentitySwitchOption> options)
static void setUIPolicyIdentityOID(Context context, String oid, MAMSetUIIdentityCallback mamSetUIIdentityCallback)
Set the associated identity with the Context.
static void setUIPolicyIdentityOID(Context context, String oid, MAMSetUIIdentityCallback mamSetUIIdentityCallback, EnumSet<IdentitySwitchOption> options)
Set the associated identity with the Context.
static void showDiagnostics(Context context)
Display the Intune Diagnostics screen.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void bypassConditionalLaunchChecks (Activity activity)

Allow the given Activity to bypass conditional launch checks. This must be called before onMAMCreate, e.g. from the Activity's constructor or attachBaseContext() override. Because this method allows the bypass of conditional launch policy checks, it should only be used after consulting with Microsoft to confirm there is no other supported way to achieve your app’s desired behavior.

Parameters
activity The activity to exempt from the launch checks.

public static String getCurrentIdentity (Context context)

This method is deprecated.
Use getCurrentIdentityOID(Context).

Computes the current effective identity that will be used for policy and returns its UPN. The following identity sources are considered in order: 1. Thread 2. Context (UI identity) 3. Process 4. Default (empty string for multi-identity apps or apps with no policy, managed user for single-identity apps)

Parameters
context context to check identity on for (2) above
Returns
  • effective identity's UPN.

public static String getCurrentIdentityOID (Context context)

Computes the current effective identity that will be used for policy and returns its AAD OID. The following identity sources are considered in order: 1. Thread 2. Context (UI identity) 3. Process 4. Default (empty string for multi-identity apps or apps with no policy, managed user for single-identity apps)

Parameters
context context to check identity on for (2) above
Returns
  • effective identity's OID.

public static String getCurrentThreadIdentity ()

This method is deprecated.
Use getCurrentThreadIdentityOID().

Get the UPN of the current thread identity.

Returns
  • Current thread identity UPN.

public static String getCurrentThreadIdentityOID ()

Get the AAD OID of the current thread identity.

Returns
  • Current thread identity OID.

public static AppPolicy getCurrentThreadPolicy ()

Get the current app policy. This does NOT take the UI (Context) identity into account. To take UI identity into account, use the override which takes a Context.

Returns
  • Policy for the current identity.

public static boolean getIsIdentityManaged (String identity)

This method is deprecated.
Use getIsIdentityOIDManaged(String).

Parameters
identity identity
Returns
  • true if the identity has policy

public static boolean getIsIdentityOIDManaged (String oid)

Parameters
oid AAD OID of the identity.
Returns
  • true if the identity has policy

public static AppPolicy getPolicy (Context context)

Get the current app policy.

Parameters
context for which the policy will be applicable. This is used to retrieve the UI identity.
Returns
  • Policy for the current identity.

public static AppPolicy getPolicy ()

This method is deprecated.
Use getCurrentThreadPolicy().

Deprecated alias for getCurrentThreadPolicy.

Returns
  • see getCurrentThreadPolicy

public static AppPolicy getPolicyForIdentity (String identity)

This method is deprecated.
Use getPolicyForIdentityOID(String).

Get the applicable app policy for a given identity.

Parameters
identity Identity to get policy for.
Returns
  • Policy for the identity.

public static AppPolicy getPolicyForIdentityOID (String oid)

Get the applicable app policy for a given identity.

Parameters
oid AAD OID of the identity to get policy for.
Returns
  • Policy for the identity.

public static String getProcessIdentity ()

This method is deprecated.
Use getProcessIdentityOID().

Get the UPN of the process-wide identity.

Returns
  • Current process-wide identity UPN.

public static String getProcessIdentityOID ()

Get the AAD OID of the process-wide identity.

Returns
  • Current process-wide identity OID.

public static String getUIPolicyIdentity (Context context)

This method is deprecated.
Use getUIPolicyIdentityOID(Context).

Get the UPN of the current UI identity.

Parameters
context Context to get the identity from.
Returns
  • Current UI identity UPN.

public static String getUIPolicyIdentityOID (Context context)

Get the AAD OID of the current UI identity.

Parameters
context Context to get the identity from.
Returns
  • Current UI identity OID.

public static MAMIdentitySwitchResult setCurrentThreadIdentity (String identity)

This method is deprecated.
Use setCurrentThreadIdentityOID(String).

Set the current thread identity.

Parameters
identity UPN of identity to set. If null, the current thread identity is cleared.
Returns
  • SUCCEEDED after thread identity is set correctly. FAILED if the app is not MI-enabled.

public static MAMIdentitySwitchResult setCurrentThreadIdentityOID (String oid)

Set the current thread identity.

Parameters
oid AAD OID of identity to set. If null, the current thread identity is cleared.
Returns
  • SUCCEEDED after thread identity is set correctly. FAILED if the app is not MI-enabled.

public static MAMIdentitySwitchResult setProcessIdentity (String identity)

This method is deprecated.
Use setProcessIdentityOID(String).

Set the process-wide identity.

Parameters
identity UPN of new process-wide identity. If null, the process identity is cleared.
Returns
  • SUCCEEDED after process identity is set correctly. FAILED if the app is not MI-enabled.

public static MAMIdentitySwitchResult setProcessIdentityOID (String oid)

Set the process-wide identity.

Parameters
oid AAD OID of new process-wide identity. If null, the process identity is cleared.
Returns
  • SUCCEEDED after process identity is set correctly. FAILED if the app is not MI-enabled.

public static void setUIPolicyIdentity (Context context, String identity, MAMSetUIIdentityCallback mamSetUIIdentityCallback)

This method is deprecated.
Use setUIPolicyIdentityOID(Context, String, MAMSetUIIdentityCallback).

Set the associated identity with the Context.

Parameters
context Context to set the identity in.
identity UPN of new identity to set. If null, the Context identity is cleared.
mamSetUIIdentityCallback callback to notify the application the identity switch result. May be null.

public static void setUIPolicyIdentity (Context context, String identity, MAMSetUIIdentityCallback mamSetUIIdentityCallback, EnumSet<IdentitySwitchOption> options)

This method is deprecated.
Use setUIPolicyIdentityOID(Context, String, MAMSetUIIdentityCallback, EnumSet).

Set the associated identity with the Context.

Parameters
context Context to set the identity in.
identity UPN of new identity to set. If null, the Context identity is cleared.
mamSetUIIdentityCallback callback to notify the application the identity switch result. May be null.
options Identity switch options.

public static void setUIPolicyIdentityOID (Context context, String oid, MAMSetUIIdentityCallback mamSetUIIdentityCallback)

Set the associated identity with the Context.

Parameters
context Context to set the identity in.
oid AAD OID of new identity to set. If null, the Context identity is cleared.
mamSetUIIdentityCallback callback to notify the application the identity switch result. May be null.

public static void setUIPolicyIdentityOID (Context context, String oid, MAMSetUIIdentityCallback mamSetUIIdentityCallback, EnumSet<IdentitySwitchOption> options)

Set the associated identity with the Context.

Parameters
context Context to set the identity in.
oid AAD OID of new identity to set. If null, the Context identity is cleared.
mamSetUIIdentityCallback callback to notify the application the identity switch result. May be null.
options Identity switch options.

public static void showDiagnostics (Context context)

Display the Intune Diagnostics screen.

Parameters
context App's context.