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?
The method: getApplicationRestrictions() returns a bundle. Probably your bundle is empty, if it is not, you have to navigate inside bundle (as a JsonObject) and get the value that you want.