notification_incoming_call

Last updated:

0 purchases

notification_incoming_call Image
notification_incoming_call Images
Add to Cart

Description:

notification incoming call

notification_incoming_call #
A Flutter plugin to show incoming call notification in your Flutter app(Custom for Android/iOS).
⭐ Features #


Show an incoming call


Start an outgoing call



🚀  Installation #

Install Packages


Run this command:
flutter pub add notification_incoming_call
copied to clipboard

Add pubspec.yaml:
dependencies:
notification_incoming_call: any
copied to clipboard



Configure Project


Android

AndroidManifest.xml

<manifest...>
...
<!--
Using for load image from internet
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
copied to clipboard

iOS

Info.plist

<key>UIBackgroundModes</key>
<array>
<string>processing</string>
<string>remote-notification</string>
<string>voip</string>
</array>
copied to clipboard



Usage



Import
import 'package:notification_incoming_call/notification_incoming_call.dart';
copied to clipboard


Received an incoming call
this._currentUuid = _uuid.v4();
var params = <String, dynamic>{
'id': _currentUuid,
'nameCaller': 'Baron Nwobi',
'appName': 'Callkit',
'avatar': 'https://i.pravatar.cc/100',
'handle': '0123456789',
'type': 0,
'duration': 30000,
'extra': <String, dynamic>{'userId': '1a2b3c4d'},
'headers': <String, dynamic>{'apiKey': 'Abc@123!', 'platform': 'flutter'},
'android': <String, dynamic>{
'isCustomNotification': true,
'isShowLogo': false,
'backgroundColor': '#0955fa',
'backgroundUrl': 'https://i.pravatar.cc/500',
'actionColor': '#4CAF50'
},
'ios': <String, dynamic>{
'iconName': 'AppIcon40x40',
'handleType': 'generic',
'supportsVideo': true,
'maximumCallGroups': 2,
'maximumCallsPerCallGroup': 1,
'audioSessionMode': 'default',
'audioSessionActive': true,
'audioSessionPreferredSampleRate': 44100.0,
'audioSessionPreferredIOBufferDuration': 0.005,
'supportsDTMF': true,
'supportsHolding': true,
'supportsGrouping': false,
'supportsUngrouping': false,
'ringtonePath': 'Ringtone.caf'
}
};
await NotificationIncomingCall.showCallkitIncoming(params);
copied to clipboard


Started an outgoing call
this._currentUuid = _uuid.v4();
var params = <String, dynamic>{
'id': this._currentUuid,
'nameCaller': 'Baron Nwobi',
'handle': '0123456789',
'type': 1,
'extra': <String, dynamic>{'userId': '1a2b3c4d'},
'ios': <String, dynamic>{'handleType': 'generic'}
};
await NotificationIncomingCall.startCall(params);
copied to clipboard


Ended an incoming/outgoing call
var params = <String, dynamic>{'id': this._currentUuid};
await NotificationIncomingCall.endCall(params);
copied to clipboard


Ended all calls
await NotificationIncomingCall.endAllCalls();
copied to clipboard


Get active calls. iOS: return active calls from Callkit, Android: only return last call
await NotificationIncomingCall.activeCalls();
copied to clipboard
Output
[{"id": "8BAA2B26-47AD-42C1-9197-1D75F662DF78", ...}]
copied to clipboard


Listen events
NotificationIncomingCall.onEvent.listen((event) {
switch (event!.name) {
case CallEvent.ACTION_CALL_INCOMING:
// TODO: received an incoming call
break;
case CallEvent.ACTION_CALL_START:
// TODO: started an outgoing call
// TODO: show screen calling in Flutter
break;
case CallEvent.ACTION_CALL_ACCEPT:
// TODO: accepted an incoming call
// TODO: show screen calling in Flutter
break;
case CallEvent.ACTION_CALL_DECLINE:
// TODO: declined an incoming call
break;
case CallEvent.ACTION_CALL_ENDED:
// TODO: ended an incoming/outgoing call
break;
case CallEvent.ACTION_CALL_TIMEOUT:
// TODO: missed an incoming call
break;
case CallEvent.ACTION_CALL_CALLBACK:
// TODO: only Android - click action `Call back` from missed call notification
break;
case CallEvent.ACTION_CALL_TOGGLE_HOLD:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_MUTE:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_DMTF:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_GROUP:
// TODO: only iOS
break;
case CallEvent.ACTION_CALL_TOGGLE_AUDIO_SESSION:
// TODO: only iOS
break;
}
});
copied to clipboard


Call from Native (iOS PushKit)
var info = [String: Any?]()
info["id"] = "44d915e1-5ff4-4bed-bf13-c423048ec97a"
info["nameCaller"] = "Baron Nwobi"
info["handle"] = "0123456789"
SwiftNotificationIncomingCallPlugin.sharedInstance?.showCallkitIncoming(notification_incoming_call.Data(args: info), fromPushKit: true)
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.