I need to implement an android config by a MDM (like Intunes). So I find the app_restictions. To do this, I did this in AndroidManifest.xml:
<meta-data android:name="android.content.APP_RESTRICTIONS"
android:resource="@xml/app_restrictions" />
And this in app_restrictions.xml:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:key="domain"
android:title="Server domain"
android:restrictionType="string"/>
</restrictions>
So, when I put this piece of code I have a bad result:
val myRestrictionsMgr: RestrictionsManager = this.getSystemService(Context.RESTRICTIONS_SERVICE) as RestrictionsManager
val appRestrictions: Bundle = myRestrictionsMgr.applicationRestrictions
Log.e(TAG, appRestrictions.hasFileDescriptors().toString()) // "False"
val domain: String? =
if (appRestrictions.containsKey("domain")) {
appRestrictions.getString("domain")
} else {
"NOP"
}
Log.e(TAG, domain.toString()) // "NOP"
And to finish, when I try to deploy my app by a MDM, the configuration doesn't not appear.