Skip to main content

telephony_kit 0.6.0 copy "telephony_kit: ^0.6.0" to clipboard
telephony_kit: ^0.6.0 copied to clipboard

Phone calls, dialer role, in-call control, SIM, network and call log APIs for Flutter on Android, using JNI bindings generated by jnigen. No method channels.

example/example.md

telephony_kit examples #

The full example in lib/main.dart is a working dialer with a keypad, recent calls, contacts, device info, call blocking, messages and an in-call screen. Run it with flutter run on an Android phone or emulator and tap Set default to make it the phone app.

Place a call and read the device #

import 'package:telephony_kit/telephony_kit.dart';

final telephony = TelephonyKit.instance;

void callSupport() {
  if (telephony.hasPermission(TelephonyPermission.callPhone)) {
    telephony.placeCall('+201001234567');
  } else {
    telephony.openDialer('+201001234567'); // no permission needed
  }
  final info = telephony.getNetworkInfo();
  print('${info.networkOperatorName} ${telephony.networkGeneration.label}');
}

Show your own in-call screen #

// After requestDefaultDialer() and declaring TelephonyKitInCallService.
telephony.callEvents.listen((event) {
  final live = telephony.calls.where((c) => c.state.isLive).toList();
  if (live.isEmpty) return closeInCallScreen();
  final call = live.firstWhere(
    (c) => c.state == CallState.ringing,
    orElse: () => live.last,
  );
  showInCallScreen(call); // call.answer(), call.hangUp(), call.hold() ...
});

Block calls, even when the app is closed #

final rules = telephony.screening;
rules.blockNumber('+201001234567');
rules.blockPrefix('0900');
rules.unknownCallerAction = ScreeningAction.silence;
final missed = telephony.searchCallLog(types: {CallLogType.missed}, limit: 20);
final people = telephony.searchContacts('ahmed');
final balance = await telephony.sendUssd('*100#');
5
likes
0
points
199
downloads

Publisher

unverified uploader

Weekly Downloads

Phone calls, dialer role, in-call control, SIM, network and call log APIs for Flutter on Android, using JNI bindings generated by jnigen. No method channels.

Repository (GitHub)
View/report issues

Topics

#telephony #dialer #phone #calls #jni

License

unknown (license)

Dependencies

flutter, jni, jni_flutter

More

Packages that depend on telephony_kit

Packages that implement telephony_kit