我正在使用 flutter 制作一个应用程序,该应用程序使用用户手机中的联系人(使用 contact_services 插件)。因此,它还需要提供使用系统默认添加联系人页面添加新联系人的能力。但是 contacts_services 中没有这样的功能。使用插件或现有的 contact_services 插件打开添加新联系人页面的方法是什么?
void openAddContacts() async{
if (Platform.isAndroid) {
final AndroidIntent intent = AndroidIntent(
action: 'ContactsContract.Intents.Insert.ACTION',
category: 'ContactsContract.RawContacts.CONTENT_TYPE',
);
await intent.launch();
}
}
最佳答案
这可能对您有帮助:https://github.com/differenz-system/Addressbook.Flutter 或者,如果您想深入研究并想了解幕后机制,我建议您使用 Platform Channel 与 native 代码进行通信。这是谷歌为地址簿提出的一个例子:https://developers.google.com/protocol-buffers/docs/darttutorial
关于android - 如何在flutter中打开android平台上的添加联系人页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59688766/