내용으로 건너뛰기

안드로이드 설정

1. Intune Gradle 플러그인을 추가하세요

제목이 "1. Intune Gradle 플러그인을 추가하세요"

앱 프로젝트의 최상위 android/build.gradle, Intune Gradle 플러그인 JAR를 buildscript 클래스 패스에 추가하세요. 플러그인 패키지는:

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

또한 Ionic이 현재 Intune Android SDK 릴리스에 대해 설명하는 Duo Maven 피드를 포함하세요.

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

android/app/build.gradle:

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

그리고 리소스 최적화 기능을 비활성화하세요.

android.enableResourceOptimizations=false

만들기 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> 태그를 구성하십시오. <application> 태그

제목: “4. <application> 태그를 구성하십시오.”

앱이 이미 커스텀 <application> 태그를 정의하지 않았다면, Application복사

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

확장하고 등록 Application에서 MAMApplication 5. 브로커 인증 쿼리와 리다이렉트 처리를 추가하십시오. IntuneMamServiceAuthenticationCallback If your app does not already define a custom onMAMCreate().

패키지 가시성 쿼리를 Ionic 문서에 추가합니다:

  • com.azure.authenticator
  • com.microsoft.windowsintune.companyportal
  • 브라우저 감지 의도

또한 BrowserTabActivity redirect URI 호스트/경로와 함께 msauth:// MSAL이 로그인 라운드 트립을 완료할 수 있도록 합니다.

Once the app-level native setup is complete, the Capacitor API is the same as on iOS:

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