[英]Authority com.android.contacts not found exception when doing applyBatch
I have this code: 我有以下代码:
context.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
On some phones (user report it to me) it causes a: 在某些电话上(用户向我报告),它会导致:
java.lang.IllegalArgumentException: Unknown authority com.android.contacts
java.lang.IllegalArgumentException:未知权限com.android.contacts
However similar authority is listed within installed packages: 但是,已安装的软件包中列出了类似的权限:
contacts;com.android.contacts
通讯录; com.android.contacts
or 要么
com.google.contacts.gal.provider
com.google.contacts.gal.provider
Note contacts; 注意联系人; prefix - does not seem good to me.
前缀-对我来说似乎不好。 I used this code to get it:
我使用以下代码来获取它:
String message="";
for (android.content.pm.PackageInfo pack : context.getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) {
ProviderInfo[] providers = pack.providers;
if (providers != null) {
for (ProviderInfo provider : providers) {
message=message+", "+provider.authority;
}
}
}
Do you think it's appropriate to failover to contacts;com.android.contact if com.android.contacts fails?? 您认为将故障转移到通讯录是否合适;如果com.android.contacts失败,则将其转换为Com.android.contact吗?
Contacts provider lists "contacts;com.android.contacts" in his authorities. 联系人提供商在其权限中列出了“ contacts; com.android.contacts”。 This list should be parsed by a content resolver, you don't need to use this string as a authority.
此列表应由内容解析器解析,您无需将此字符串用作授权。
Probably you need to find out more about phones with this problem. 可能您需要了解有关此问题的手机的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.