A Flutter plugin to access and query call history log.
Support for Android only as iOS does not provide API for accessing call history
To use this plugin, add
call_log as a dependency in your
You may add the following permission to your Android Manifest:
<uses-permission android:name="android.permission.READ_CALL_LOG" />
This plugin is able to handle checking and requesting permission automatically.
Currently implemented query params are dateFrom, dateTo, durationFrom, durationTo, name and number.
String params are queried using LIKE and '%' wildcard on both sides.
// IMPORT PACKAGE import 'package:call_log/call_log.dart'; // GET WHOLE CALL LOG Iterable<CallLogEntry> entries = await CallLog.get(); // QUERY CALL LOG (ALL PARAMS ARE OPTIONAL) var now = DateTime.now(); int from = now.subtract(Duration(days: 60)).millisecondsSinceEpoch; int to = now.subtract(Duration(days: 30)).millisecondsSinceEpoch; Iterable<CallLogEntry> entries = await CallLog.query( dateFrom: from, dateTo: to, durationFrom: 0, durationTo: 60, name: 'John Doe', number: '901700000', type: CallType.incoming, );
- [x] query call log using most common fields, using AND as a logical gate
- [ ] query call log with full power of native API
Contribution and Support #
- Contributions are welcome!
- If you want to contribute code please create a PR
- If you find a bug or want a feature, please fill an issue
- Migration from
androidxpackages that allows this library to be used with flutter projects that use
androidx. If you need to stay on
android.supportfor whatever reason, don't upgrade as it may break your build. See more.
- Lowered minSdkVersion as requested per #1
- documentation modifications
- fixing NullPointerException when onRequestPermissionsResult was triggered by different plugin than this one
- more details in README.md
- documentation modifications based on flutter package analysis
- code reformat using flutter format
- Query log entries based on 'type' attribute
- Initial release
- Support for Android only as iOS does not provide API for call history
- Check if access permissions are granted
- Request access permissions
- Get all call log entries
- Query log entries
- fromDate: get all entries from this date
- toDate: get all entries until this date
- name: get all entries for this contact name
- number: get all entries for this telephone number
Demonstrates how to use the call_log plugin.
Getting Started #
For help getting started with Flutter, view our online documentation.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: call_log: ^2.0.0
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.7.1
- pana: 0.13.5
- Flutter: 1.12.13+hotfix.7