android 10 이상 제약사항
READ_PRIVILEGED_PHONE_STATE
권한이 필요한데, 이는 런타임에 요청할 수 있는 권한이 아니다.
/etc/permissions에 추가하려면?
AOSP를 이용해 안드로이드 운영체제 개발 시에 AOSP 명령툴을 이용해서 권한을 명시한 xml 파일을 만들어야 한다.
나는 삼성의 knox를 이용하고 있었으므로, knox 측에 기술지원으로 우리 앱도 권한을 받아서 쓸 수 있는지 문의했다.
( 기술지원이 안된다면 knox를 버려야 하므로 )
내 앱을 디바이스 어드민으로 설치해서 조회하기
디바이스 오너십은 하나의 앱만 가질 수 있으며 양도될 수 없다.
따라서 공장초기화 후 내 앱이 오너십을 받을 수 있도록 별도 설치 과정을 거쳐야 한다.
this is how I did it:
- first you need to reset the device to factory settings (you could actually transfer the ownership, but we haven't tested that yet)
- When you then restart it, tap 6 times on the main panel (above the start button). This will open a qrcode reader, where you have to scan a qrcode based on a json. This json contains the apk url and other info. This will install the app as the device admin .
- To distribute updates you can send push notifications to all the devices and have the app download the updated apk . The app can install the new apk programmatically and restart itself.
We can access the ICCID and the device serial number (being the device admin you can do a lot more things, like changing settings, reboot the device, etc). We had in production this mode for a couple of years now and it's well tested. If you need more info you can DM me.Here some references :EDIT: sorry, I just read that you use knox. We had to drop that because Knox is the device admin and can't transfer its ownership to other apps. If you need to access those info, there's no really way unless you reset those devices and drop knox.