我正在尝试使用MobileIron EMM为我的应用程序设置远程配置。我已经按照开发人员指南中的说明进行了所有操作:1.我设置了清单:
...
<meta-data
android:name="android.content.APP_RESTRICTIONS"
android:resource="@xml/app_restrictions"/>
</application>
Run Code Online (Sandbox Code Playgroud)
2.我已经描述了限制:
<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
android:title="@string/some_title"
android:key="SOME_KEY"
android:restrictionType="string"
android:defaultValue="123"/>
</restrictions>
Run Code Online (Sandbox Code Playgroud)
3.我正在尝试接收以下内容:
RestrictionsManager manager = (RestrictionsManager) context.getSystemService(Context.RESTRICTIONS_SERVICE);
Bundle b = manager.getApplicationRestrictions();
if(b!=null){
if(b.containsKey("SOME_KEY")) {
return b.getString("SOME_KEY");
}else{
System.out.println("bundle is not null");
for (String s: b.keySet()){
System.out.println("key in b is : " + s);
}
System.out.println(b.isEmpty() + " bundle is empty");
}
}else{
System.out.println("Bundle is null");
}
return "";
}
Run Code Online (Sandbox Code Playgroud)
我总是得到输出:
bundle is not null
true bundle is empty
Run Code Online (Sandbox Code Playgroud)
尽管我已为限制设置了默认值。为什么我至少没有获得限制的默认值?为什么我从未获得实际值(在服务器端,我已经使用MobileIron Cloud及其AppConnect配置设置了值)?尝试了几种设备。我想念什么?请帮忙。我的目标是为应用程序远程设置一些键值。