call_watcher 1.2.1 copy "call_watcher: ^1.2.1" to clipboard
call_watcher: ^1.2.1 copied to clipboard

a flutter plugin to listen to call state changes and maintain a call ledger.

call_watcher #

a flutter plugin to listen to call status, and mantain a call log, uses CallKit on iOS

Usage #

import 'package:call_watcher/call_watcher.dart';


void initiateCall() async {
  try {
    await CallWatcher.initiateCall("1234567890");
  } catch (e) {
    print(e);
  }
}

void getCallLogs() {
  CallWatcher.getCallLogs().then((logs) {
    print(logs);
  }); 
}


void endCurrentCall() async {
  try {
    await CallWatcher.endCurrentCall();
  } catch (e) {
    print(e);
  }
}

void getLastCalledNumber() {
  CallWatcher.getLastCalledNumber().then((number) {
    print(number);
  });
}

final query = LogQuery(
    name: 'John Doe',
    number: '1234567890',
    isOutgoing: true,
    dateFrom: DateTime.now().subtract(Duration(days: 7)),
    dateTo: DateTime.now(),
    durationFrom: 0,
    durationTo: 100,
 );
 
final logs = await CallWatcher.getQueryCallLogs(query);

Platform Specifics #

iOS #

add these permissions to your ios/Runner/Info.plist in your app

<key>NSUserActivityTypes</key>
<array>
    <string>INStartAudioCallIntent</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>tel</string>
</array>

Usage on Android #

add these permissions to your AndroidManifest.xml in your app

  <!-- Add this inside the <application> tag in AndroidManifest.xml -->
  <service android:name=".CallControlService"
      android:permission="android.permission.BIND_INCALL_SERVICE"
      android:exported="true">
      <intent-filter>
          <action android:name="android.telecom.InCallService"/>
      </intent-filter>
  </service>
  ...
  <uses-permission android:name="android.permission.CALL_PHONE" />
  <uses-permission android:name="android.permission.READ_CALL_LOG" />
  <!-- If you want to clear call log (Optional)  -->
  <uses-permission android:name="android.permission.WRITE_CALL_LOG" />

Pending: #

  • ❌ Query call logs
  • ❌ Callback from native to flutter
2
likes
150
pub points
54%
popularity

Publisher

verified publisherstackfinance.co

a flutter plugin to listen to call state changes and maintain a call ledger.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on call_watcher