[英]Cannot save name field in contact book in Oxygen OS 11
I have been trying to save contact into contact book via the following code,我一直在尝试通过以下代码将联系人保存到通讯录中,
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.putExtra(ContactContracts.Intents.NAME, "Ryan");
While the above code works perfectly on most of the devices but not working in Oxygen OS 11 One plus devices.虽然上面的代码在大多数设备上都能完美运行,但在 Oxygen OS 11 One plus 设备上却无法运行。 The name field comes empty while saving while other fields are inserted properly The code works fine on Android 11 emulator and the issue seems to be specific to Oxygen OS 11. I assume they replaced the accepted "key" for name field in ContactsContract class.名称字段在保存时为空,而其他字段已正确插入代码在 Android 11 模拟器上运行良好,问题似乎特定于 Oxygen OS 11。我假设他们替换了 ContactsContract class 中名称字段接受的“密钥”。
For anyone still looking for an answer,对于仍在寻找答案的任何人,
I tried changing the key, it does not work.我尝试更改密钥,它不起作用。 What worked for me is either opening google contacts / adding contact directly via content provider.对我有用的是打开谷歌联系人/直接通过内容提供商添加联系人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.