pit_sms_call_log 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

PIT SMS and Call Logs #

Use this Plugin to get SMS and Call Logs.

Note: This plugin is still under development, and some Components might not be available yet or still has so many bugs and this plugin just for android only.

Installation #

First, add pit_sms_call_log as a dependency in your pubspec.yaml file.

pit_sms_call_log: ^0.1.1

Important #

this plugin depends on other plugins, you must have a permission to use this plugin, you can use pit_permission plugin or other permission plugin.

You must add this permission in AndroidManifest.xml for Android

for read sms =  <uses-permission android:name="android.permission.READ_SMS"/>

for read call logs = <uses-permission android:name="android.permission.READ_CALL_LOG"/>

Example for Get SMS #

     List<SmsLog> smsList = await PitSmsCallLog.getSmsLog(daysBefore: 3);

Example for Get Call Logs #

     List<CallLog> callLogs = await PitSmsCallLog.getCallLog(daysBefore: 20);

0.1.1 #

  • version 0.1.1, Fix Bug and Enhance Code

0.1.0+2 #

  • On Ios change result to result(FlutterMethodNotImplemented)

0.1.0+1 #

  • Fix Bug

0.1.0 #

  • version 0.1.0

0.0.1 #

example/README.md

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

import 'package:flutter/services.dart';
import 'package:pit_sms_call_log/pit_sms_call_log.dart';

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

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

class _MyAppState extends State<MyApp> {

  List<SmsLog> smsList = [] ;
  List<CallLog> callLogs = [];

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }


  Future<void> initPlatformState() async {

    List<SmsLog> smsList = [] ;
    List<CallLog> callLogs = [];
    try {
      smsList = await PitSmsCallLog.getSmsLog(daysBefore: 3);
      callLogs = await PitSmsCallLog.getCallLog(daysBefore: 20);
    } on PlatformException {
      print('error');
    }

    if (!mounted) return;
    setState(() {
      this.smsList = smsList;
      this.callLogs = callLogs;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
//          child: Text('Call Logs :\n $callLogs'),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text('SMS List :\n'),
              _buildItemSmsLog(),
              Text('Call Log :\n'),
              _buildItemCallLog()
            ],
          )

        ),
      ),
    );
  }

  _buildItemSmsLog(){
    List<Widget> item = [];
    smsList.forEach((sms){
      item.add(
        Container(
          child: Text("Address : ${sms.address}, Body : ${sms.body}, Date : ${sms.date}"),
          margin: EdgeInsets.only(left: 16, right: 16, bottom: 16),
        )

      );
    });
    return Column(children: item,);
  }

  _buildItemCallLog(){
    List<Widget> item = [];
    callLogs.forEach((call){
      item.add(
          Container(
            child: Text("Call Type : ${call.callType}, Call Number : ${call.callNumber}, Call Date : ${call.callDate}, "
                +"Call Duration : ${call.callDuration} second" ),
            margin: EdgeInsets.only(left: 16, right: 16, bottom: 16),
          )

      );
    });
    return Column(children: item,);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  pit_sms_call_log: ^0.1.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:pit_sms_call_log/pit_sms_call_log.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
38
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

27 out of 27 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/pit_sms_call_log.dart.

Run flutter format to format lib/pit_sms_call_log.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test