I have this in app_restrictions.xml:
<restriction
android:key="int1"
android:restrictionType="integer"
android:defaultValue="0"
/>
Now if I want to read it I get
> java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
I tried:
RestrictionsManager rm = getApplicationContext().getSystemService(Context.RESTRICTIONS_SERVICE);
Integer val1 = rm.getApplicationRestrictions().getInt("int1");
I have no problem to read Booleans or Strings. Google doesn't provide examples for Integer. Is the interger restriction type usable at all? If so: how?
getInt() works as expected. The problem seems to be Test DPC. I didn't select the right type for a restriction of type choice in Test DPC. Choice isn't really supported in Test DPC. You have to type in a value and select it's type. Maybe integer values doesn't work at all for choice restrictions. I'll try with a real MDM system later...