简体   繁体   English

执行applyBatch时未找到权限com.android.contacts异常

[英]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.

相关问题 ShowCallLog Intent 在由“com.android.contacts”处理时不起作用 - ShowCallLog Intent not working when handled by "com.android.contacts" 未能为用户 0 找到提供者 com.android.contacts,预计会为此权限找到有效的内容提供者 - failed to find provider com.android.contacts for user 0, expected to find a valid contentprovider for this authority 如何打开com.android.contacts / .CallDetalActivity - how to open com.android.contacts/.CallDetalActivity android 中 content://com.android.contacts 的用途是什么 - What is use of content://com.android.contacts in android android联系人源代码com.android.contacts - android contact source code com.android.contacts 如何保存从com.android.contacts,Android中提取的图像? - How to save image extracted from com.android.contacts, Android? java.io.FileNotFoundException:content://com.android.contacts/contacts/24093/photo仅适用于旧照片 - java.io.FileNotFoundException: content://com.android.contacts/contacts/24093/photo for old photos only 使用什么代替Contacts.Intents.UI.LIST_STARRED_ACTION在com.android.contacts中显示已加星标的联系人? - What to use instead of Contacts.Intents.UI.LIST_STARRED_ACTION to display starred contacts in com.android.contacts? Adobe air内容:\\\\ com.android.contacts \\ display_photo \\加载照片 - Adobe air content:\\com.android.contacts\display_photo\ load a photo 无法传递结果ResultInfo {who = null,request = 1,result = -1,data = Intent {dat = content://com.android.contacts/contacts/lookup…}} - Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.android.contacts/contacts/lookup…}}
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM