跳过内容

安卓设置

GitHub

1. 在 Intune Gradle 插件中添加

标题:1. 在 Intune Gradle 插件中添加

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

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

还包括 Ionic 文档中用于当前 Intune Android SDK 版本的 Duo Maven feed:

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

2. 更新应用程序模块

标题:2. 更新应用程序模块

In 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"
}
}
]
}

该插件在运行时期期望该文件,用于 MSAL 和 Intune 认证回调。

4. 配置 <application> 标签

标题:4. 配置 <application> 标签

If your app does not already define a custom Applicationset:

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

If you already have a custom Applicationextend MAMApplication and register IntuneMamServiceAuthenticationCallback in onMAMCreate().

5. Add broker auth queries and redirect handling

Section titled “5. Add broker auth queries and redirect handling”

Add the package visibility queries Ionic documents for:

  • com.azure.authenticator
  • com.microsoft.windowsintune.companyportal
  • browser detection intents

Also add 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 设置

标题:继续从 Android 设置

如果您正在使用 Android 设置 来规划本机插件工作,连接它与 使用 @capgo/capacitor-intune 为使用 @capgo/capacitor-intune 的原生功能 Capgo 插件目录 为 Capgo 插件目录 中的产品工作流 Capacitor 由 Capgo 提供的插件 为 Capacitor 由 Capgo 提供的插件 中的实现细节 添加或更新插件 为添加或更新插件 中的实现细节,以及 Ionic 企业插件替代方案 为 Ionic 企业插件替代方案 中的产品工作流