【问题标题】:Update android contact by Expo project通过 Expo 项目更新 android 联系人
【发布时间】:2020-12-31 14:25:47
【问题描述】:

我有一个使用 Expo Contact 模块来自动更新联系人的项目。
这是我更新所选电话号码的脚本

const updateContact = async (callId, newCall) => {
  getSingleContact(callId)
    .then(resp => {
        .......
        Contacts.updateContactAsync(contact)
            .then(updCall => console.log('updateCall :::> ', updCall))
    })
    .catch(error => console.log('Error detected :::> ', error))
 }

我的程序返回 callId

请解释我如何通过联系人模块更新数据

【问题讨论】:

    标签: javascript node.js react-native expo


    【解决方案1】:

    我已经通过 react-native-contacts 解决了这个问题。 因为默认Expo没有保证这个功能click for more information

    这是 Expo docx (Contacts.updateContactAsync(contact))

    在 Android 上,您可以使用 presentFormAsync 对联系人进行编辑。由于 iOS 错误,无法修改 nonGregorianBirthday。

    Contacts.updateContactAsync(contact: Contact): Promise<string>
    

    对于react-native-contacts 模块

    1. 安装

      添加 react-native-contacts

    2. 权限

    向 AndroidManifest.xml 添加 READ_CONTACTS 和/或 WRITE_PROFILE 权限

    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    
    1. 示例

      点击here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多