android - 如何在flutter中打开android平台上的添加联系人页面?

标签 android flutter dart

我正在使用 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/

相关文章:

android - 在 Android 上,使用 BLE,您可以扫描设备并连接/保持与设备的连接吗?

android - REST api项目的用户认证方法

flutter - 如何 TextField 隐藏/显示在 flutter 中点击文本

flutter - 耀斑动画图标尺寸太小

flutter - 成员 'setState' 只能在 'package:flutter/src/widgets/framework.dart' 的子类的实例成员中使用

flutter - 如何在 Dart/Flutter 中找到从一个列表匹配到另一个列表的所有元素的索引

android - 应用内计费测试手机

java - arrayList 似乎仅在先完成一个 Activity (而不是另一个 Activity )时才会创建

Flutter 和 Dart 尝试 catch——catch 不会触发

asynchronous - Flutter: future 和共同偏好