Giter Site home page Giter Site logo

baseflow / flutter-contacts-plugin Goto Github PK

View Code? Open in Web Editor NEW
40.0 8.0 18.0 133 KB

Contact plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to read, create and update contacts from the address book.

Home Page: https://baseflow.com

License: MIT License

Ruby 4.09% Dart 93.83% Shell 2.08%
flutter flutter-plugin dart contacts ios android baseflow

flutter-contacts-plugin's Introduction

Flutter Contacts Plugin

pub package

A Flutter contacts plugin which provides easy access to the platform specific address book.

Branch Build Status
develop Build Status
master Build Status

Features

  • Automatically check and request the necessary permissions to access the platform specific address book;
  • Read contacts from the addres book;
  • [WIP] Store new contacts in the address book;
  • [WIP] Update details of existing contacts;
  • [WIP] Delete existing contacts from the address book.

Usage

To use this plugin, add contacts_plugin as a dependency in your pubspec.yaml file. For example:

dependencies:
  contacts_plugin: '^0.0.3'

NOTE: There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue Flutter#16049 for help on integration.

API

Fetch all contacts

To fetch all contacts from the address book make a call to the getContacts method:

import 'package:geolocator/contacts_plugin.dart';

List<Contact> contacts = await ContactsPlugin().getContacts();

Permissions

Android

On Android you'll need to add either the READ_CONTACTS or the WRITE_CONTACTS permissions to your Android Manifest (depending if you need read and/ or write access to the address book). Todo so open the AndroidManifest.xml file and one of the following two lines as direct children of the <manifest> tag:

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

iOS

On iOS you'll need to add the NSContactsUsageDescription to your Info.plist file in order to access the device's address book. Simply open your Info.plist file and add the following:

<key>NSContactsUsageDescription</key>
<string>This app needs access to address book.</string>

Issues

Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author

This Contacts plugin for Flutter is developed by Baseflow. You can contact us at [email protected]

flutter-contacts-plugin's People

Contributors

martijn00 avatar mvanbeusekom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-contacts-plugin's Issues

Provide the image of the contact

πŸš€ Feature Requests

Contextualize the feature

Describe the feature

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

ContactsPlugin().getContacts() returns duplicates

πŸ› Bug Report

Using the library as explained in the readme file, i'm getting duplicates of contacts (compared their ids too).

Expected behavior

Get unique contacts by their id.

Reproduction steps

Calling ContactsPlugin().getContacts().

Configuration

Version: 0.0.3

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Crash due to some gradle file

πŸ› Bug Report

FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'contacts_plugin' is using version 1.2.30.

Platform:

  • πŸ“± iOS
  • [+] πŸ€– Android

Deprecated version of the Android embedding throws warning

πŸ— Enhancement Proposal

The plugins contacts_plugin, permission_handler use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Pitch

Fixing this issue will make the library to be updated with the current Android methodologies and prevent future issues that could be caused when the deprecated feature is eventually removed from Flutter.

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • [x ] πŸ€– Android

Block contacts by phone number, name, email

I want to block phone book contacts by phone number, name, email.
So I have two questions:
1- Does it possible to block contacts in Flutter?
2- Can I use this library for contact blocking?

Add handling of raw_contacts

πŸš€ Feature Requests

Please include support for adding raw_contacts. These are basically pieces of contacts that are merged together.

Contextualize the feature

Don't understand the question.

Describe the feature

Β This would help with projects adding lower level details to contacts.
Found some information here about raw_contacts.

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • πŸ€– Android

Show contacts in some order

Hello! Greate job!
Is some way add parameter for setting order (ASC/DESC) of contacts in Flutter?
Now I can do it only modifing plugin code:
cursor = contentResolver.query(
ContactsContract.Data.CONTENT_URI,
null,
null,
null,
// ContactsContract.Contacts.SORT_KEY_PRIMARY + " ASC")
"upper("+ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + ") ASC")

Unable to resolve dependency even after adding permissions

A problem occurred configuring project ':permission_handler'.

Failed to notify project evaluation listener.
java.lang.AbstractMethodError (no error message)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Calling getContacts throws an exception on release built apk

πŸ› Bug Report

Exception is thrown after this line:
final dynamic jsonString = await _channel.invokeMethod('getContacts');

Exception details:
E/flutter (31579): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(40)] java.lang.AssertionError: AssertionError (GSON 2.8.5): java.lang.NoSuchFieldException: HOME
E/flutter (31579): at com.d.a.f.a(Unknown Source:73)
E/flutter (31579): at com.d.a.f.a(Unknown Source:8)
E/flutter (31579): at com.d.a.f.a(Unknown Source:5)
E/flutter (31579): at com.d.a.f.a(Unknown Source:13)
E/flutter (31579): at com.a.a.c.a$a.a(Unknown Source:12)
E/flutter (31579): at com.a.a.b.onMethodCall(Unknown Source:33)
E/flutter (31579): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
E/flutter (31579): at io.flutter.view.FlutterNativeView.handlePlatformMessage(Unknown Source:26)
E/flutter (31579): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (31579): at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter (31579): at android.os.Looper.loop(Looper.java:160)
E/flutter (31579): at android.app.ActivityThread.main(ActivityThread.java:6863)
E/flutter (31579): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (31579): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
E/flutter (31579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter (31579): Caused by: java.lang.AssertionError: java.lang.NoSuchFieldException: HOME
E/flutter (31579): at com.d.a.b.a.n$a.(Unknown Source:87)
E/flutter (31579): at com.d.a.b.a.n$24.a(Unknown Source:29)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:42)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:122)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:22)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.b.a(Unknown Source:26)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:42)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:122)
E/flutter (31579): at com.d.a.b.a.i.a(Unknown Source:22)
E/flutter (31579): at com.d.a.f.a(Unknown Source:74)
E/flutter (31579): at com.d.a.b.a.m.a(Unknown Source:18)
E/flutter (31579): at com.d.a.b.a.b$a.a(Unknown Source:25)
E/flutter (31579): at com.d.a.b.a.b$a.a(Unknown Source:2)
E/flutter (31579): at com.d.a.f.a(Unknown Source:34)
E/flutter (31579): ... 14 more
E/flutter (31579): Caused by: java.lang.NoSuchFieldException: HOME
E/flutter (31579): at java.lang.Class.getField(Class.java:1601)
E/flutter (31579): at com.d.a.b.a.n$a.(Unknown Source:34)
E/flutter (31579): ... 30 more
E/flutter (31579):
F/flutter (31579): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(77)] Check failed: CheckException(env).

  • The classes are minified after proguard. It might cause the exception.
  • Notice this line in the exception: java.lang.NoSuchFieldException: HOME

Expected behavior

Get the contacts

Reproduction steps

call getContacts method

Configuration

Version: 0.0.3

Platform:

  • πŸ“± iOS
  • πŸ€– Android

/Users/zhichou/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_plugin-0.0.3/ios/Classes/model/Address.swift:17:16: error: use of undeclared type 'AddressType' var type : AddressType = AddressType.other

πŸ› Bug Report

<!--- Summary description of the bug --->
/Users/zhichou/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_plugin-0.0.3/ios/Classes/model/Address.swift:17:16: error: use of undeclared type 'AddressType'
var type : AddressType = AddressType.other

Expected behavior

Reproduction steps

Configuration

Version: 1.x

Platform:

  • πŸ“± iOS
  • πŸ€– Android

Android is normal, IOS has problems

When using plug-ins, IOS has some problems:

/Users/furun/.pub-cache/hosted/pub.dartlang.org/contacts_plugin-0.0.3/ios/Classes/model/Address.swift:17:16: error: use of undeclared type 'AddressType' var type : AddressType = AddressType.other ^~~~~~~~~~~ /Users/furun/.pub-cache/hosted/pub.dartlang.org/contacts_plugin-0.0.3/ios/Classes/model/Address.swift:10:7: error: type 'Address' does not conform to protocol 'Decodable' class Address : Codable { ^ Swift.Decodable:2:5: note: protocol requires initializer 'init(from:)' with type 'Decodable' init(from decoder: Decoder) throws ^

---

Sorry, false package

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher

πŸš€ Feature Requests

when I use flutter-contact-plugin version -0.0.3, it gives me an error.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
    The following dependencies do not satisfy the required version:
    project ':contacts_plugin' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.30

Contextualize the feature

Describe the feature

Platforms affected (mark all that apply)

  • πŸ“± iOS
  • [ API 28] πŸ€– Android

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.