Android Management API (AMAPI) SDK를 사용하면 특정 앱이 Android Device Policy (ADP)와 직접 통신할 수 있습니다. 다음을 지원합니다.
AMAPI SDK를 애플리케이션과 통합하려면 다음 단계를 따라야 합니다.
- AMAPI SDK 라이브러리를 추가합니다.
- 타겟 SDK가 30 이상인 경우 쿼리 요소를 추가합니다.
기본 요건
- 앱의
minSdkVersion
가 API 수준 21 이상으로 설정되어 있는지 확인합니다. - 애플리케이션에 최신 버전의 AMAPI SDK 종속 항목을 추가합니다. 사용 가능한 최신 라이브러리 버전과 애플리케이션에 라이브러리를 추가하는 방법은 AMAPI SDK의 출시 노트 페이지에서 확인할 수 있습니다.
쿼리 요소 추가
앱이 SDK 30 이상을 타겟팅하는 경우 AndroidManifest.xml
에 쿼리 요소가 있어야 ADP와 상호작용한다는 것을 지정할 수 있습니다.
<queries>
<package android:name="com.google.android.apps.work.clouddpc" />
</queries>
자세한 내용은 Android의 패키지 공개 상태 필터링을 참고하세요.
NotificationReceiverService 구현
일부 기능은 NotificationReceiverService
를 만들어야 하고 일부 기능은 선택적으로 이를 사용합니다. 이를 사용하려면 NotificationReceiverService
를 확장하는 클래스를 정의하고 AndroidManifest.xml
에 service
로 추가한 후 내보내야 합니다.
import com.google.android.managementapi.notification.NotificationReceiverService;
...
public final class MyAppNotificationReceiverService extends NotificationReceiverService {
@Override
protected void setupInjection() {
// This method can be optionally used to inject dependencies at the
// beginning of the service lifecycle.
}
}
AndroidManifest.xml
에서 다음을 추가합니다.
<service
android:name = ".MyAppNotificationReceiverService"
android:exported = "true" />
일반적으로 NotificationReceiverService
를 구현하는 클래스의 ComponentName
는 적절한 API를 통해 Google에 전달되어야 합니다.
세부정보는 해당 기능에 따라 다르며, 이 기능이 필요한 각 기능은 이를 문서화합니다.