call_log 1.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 84

call_log #

pub package

A Flutter plugin to access and query call history log.
Support for Android only as iOS does not provide API for accessing call history

Usage #

To use this plugin, add call_log as a dependency in your pubspec.yaml file.

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.

Example #

// 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,
    );

Todo #

  • [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

1.0.1 #

  • documentation modifications based on flutter package analysis
  • code reformat using flutter format
  • Query log entries based on 'type' attribute

1.0.0 #

  • Initial release
  • Support for Android only as iOS does not provide API for call history
  • Features
    • 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

example/lib/main.dart

import 'package:call_log/call_log.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Iterable<CallLogEntry> _callLogEntries = [];

  @override
  Widget build(BuildContext context) {
    var mono = TextStyle(fontFamily: 'monospace');
    var children = <Widget>[];
    _callLogEntries.forEach((entry) {
      children.add(
        Column(
          children: <Widget>[
            Divider(),
            Text('NUMBER   : ${entry.formattedNumber}', style: mono),
            Text('NAME     : ${entry.name}', style: mono),
            Text('TYPE     : ${entry.callType}', style: mono),
            Text('DATE     : ${DateTime.fromMillisecondsSinceEpoch(entry.timestamp)}', style: mono),
            Text('DURATION :  ${entry.duration}', style: mono),
          ],
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.start,
        ),
      );
    });

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('call_log example')),
        body: SingleChildScrollView(
          child: Column(
            children: <Widget>[
              Center(
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: RaisedButton(
                    onPressed: () async {
                      var result = await CallLog.query();
                      setState(() {
                        _callLogEntries = result;
                      });
                    },
                    child: Text("Get all"),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: Column(children: children),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  call_log: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ 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:


import 'package:call_log/call_log.dart';
  
Version Uploaded Documentation Archive
2.0.0 Feb 20, 2019 Go to the documentation of call_log 2.0.0 Download call_log 2.0.0 archive
1.0.6 Jan 21, 2019 Go to the documentation of call_log 1.0.6 Download call_log 1.0.6 archive
1.0.5 Nov 5, 2018 Go to the documentation of call_log 1.0.5 Download call_log 1.0.5 archive
1.0.4 Nov 5, 2018 Go to the documentation of call_log 1.0.4 Download call_log 1.0.4 archive
1.0.3 Nov 5, 2018 Go to the documentation of call_log 1.0.3 Download call_log 1.0.3 archive
1.0.2 Oct 21, 2018 Go to the documentation of call_log 1.0.2 Download call_log 1.0.2 archive
1.0.1 Oct 21, 2018 Go to the documentation of call_log 1.0.1 Download call_log 1.0.1 archive
1.0.0 Oct 21, 2018 Go to the documentation of call_log 1.0.0 Download call_log 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

We analyzed this package on May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15
  • Flutter: 1.5.8

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8