跳过内容

Android Setup

GitHub

1. 在应用程序项目的顶级目录中,添加Intune Gradle插件JAR到classpath中。该插件包包含: android/build.gradle在应用程序项目的顶级目录中,添加Intune Gradle插件JAR到classpath中。该插件包包含: buildscript 在应用程序项目的顶级目录中,添加Intune Gradle插件JAR到classpath中。该插件包包含:

  • android/ms-intune-app-sdk-android/GradlePlugin/com.microsoft.intune.mam.build.jar

同时包含Duo Maven feed,Ionic文档中用于当前Intune Android SDK版本的:

maven {
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
name 'Duo-SDK-Feed'
}

2. 更新应用模块

标题:2. 更新应用模块

android/app/build.gradle:

apply plugin: 'com.microsoft.intune.mam'

并保持资源优化禁用:

android.enableResourceOptimizations=false

3. 提供 auth_config.json

标题:3. 提供auth_config.json

创建 android/app/src/main/res/raw/auth_config.json:

{
"client_id": "YOUR_CLIENT_ID",
"authorization_user_agent": "BROWSER",
"redirect_uri": "msauth://YOUR_PACKAGE/YOUR_SIGNATURE_HASH",
"broker_redirect_uri_registered": true,
"account_mode": "MULTIPLE",
"authorities": [
{
"type": "AAD",
"audience": {
"type": "AzureADMyOrg"
}
}
]
}

The plugin expects that file at runtime for both MSAL and the Intune auth callback.

4. 配置 <application> 标签

标题:4. 配置

The <application>标签 Application如果您的应用程序尚未定义自定义

<application
android:name="app.capgo.intune.IntuneApplication"
android:enableOnBackInvokedCallback="false">

复制到剪贴板 Application如果您已经有一个自定义 MAMApplication ,扩展 IntuneMamServiceAuthenticationCallback 并注册 onMAMCreate().

添加包可见性查询 Ionic 文档中:

  • com.azure.authenticator
  • com.microsoft.windowsintune.companyportal
  • 浏览器检测意图

此外添加 BrowserTabActivity 与您的 msauth:// 重定向 URI 主机/路径,以便 MSAL 可以完成登录圆圈。

完成应用级本机设置后,Capacitor API 与 iOS 相同:

import { IntuneMAM } from '@capgo/capacitor-intune';
const auth = await IntuneMAM.acquireToken({
scopes: ['https://graph.microsoft.com/.default'],
});
await IntuneMAM.registerAndEnrollAccount({
accountId: auth.accountId,
});

如果您正在使用 Android Setup 来规划原生插件工作,连接它与 使用 @capgo/capacitor-intune 来实现原生能力的使用 @capgo/capacitor-intune, Capgo 插件目录 来实现产品工作流程的 Capgo 插件目录, Capacitor 插件由 Capgo 来实现插件细节的 Capacitor 插件由 Capgo, 添加或更新插件 来实现添加或更新插件的细节,和 Ionic Enterprise 插件替代方案 了解Ionic企业插件替代方案的产品工作流。