Android Setup
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
1. 在 Intune Gradle 插件中添加
Section titled “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. 更新应用程序模块
Section titled “2. 更新应用程序模块”在 android/app/build.gradle:
apply plugin: 'com.microsoft.intune.mam'并保持资源优化禁用:
android.enableResourceOptimizations=false3. 提供 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> 标签如果您的应用程序尚未定义自定义 Application,设置:
<application android:name="app.capgo.intune.IntuneApplication" android:enableOnBackInvokedCallback="false">如果您已经有一个自定义 Application扩展 MAMApplication 并注册 IntuneMamServiceAuthenticationCallback 在 onMAMCreate().
5. 添加代理认证查询和重定向处理
标题为“5. 添加代理认证查询和重定向处理”添加包可见性查询Ionic文档:
com.azure.authenticatorcom.microsoft.windowsintune.companyportal- 浏览器检测意图
另外添加 BrowserTabActivity 与您的 msauth:// 重定向URI主机/路径,以便MSAL可以完成登录圆圈
6. 使用插件
6. 使用插件完成应用级本机设置后,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
标题:继续从 Android Setup如果您正在使用 Android Setup 来规划本机插件工作,连接它与 使用 @capgo/capacitor-intune 为本机能力在使用 @capgo/capacitor-intune 中 Capgo 插件目录 为产品工作流程在 Capgo 插件目录 中 Capacitor 插件由 Capgo 为 Capacitor 插件由 Capgo 的实现细节 添加或更新插件 为添加或更新插件的实现细节, 和 Ionic 企业插件替代品 为 Ionic 企业插件替代品的产品工作流