Created
March 24, 2023 01:10
-
-
Save darmawan01/429a9c82c00c8011ecce2f5fc8a742e9 to your computer and use it in GitHub Desktop.
Call Keep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_callkeep/flutter_callkeep.dart'; | |
CallKeepBaseConfig callKeepBaseConfig = CallKeepBaseConfig( | |
appName: 'Matrix POC', | |
androidConfig: CallKeepAndroidConfig( | |
logo: "ic_logo", | |
showCallBackAction: true, | |
showMissedCallNotification: true, | |
ringtoneFileName: '', | |
accentColor: '#0955fa', | |
backgroundUrl: 'assets/test.png', | |
incomingCallNotificationChannelName: 'Incoming Calls', | |
missedCallNotificationChannelName: 'Missed Calls', | |
), | |
iosConfig: CallKeepIosConfig( | |
iconName: 'CallKitLogo', | |
handleType: CallKitHandleType.generic, | |
isVideoSupported: true, | |
maximumCallGroups: 2, | |
maximumCallsPerCallGroup: 1, | |
audioSessionActive: true, | |
audioSessionPreferredSampleRate: 44100.0, | |
audioSessionPreferredIOBufferDuration: 0.005, | |
supportsDTMF: true, | |
supportsHolding: true, | |
supportsGrouping: false, | |
supportsUngrouping: false, | |
ringtoneFileName: '', | |
), | |
); | |
Future<void> startCall( | |
String uuid, | |
bool isVideo, | |
String caller, | |
String userId, | |
) async { | |
final config = CallKeepOutgoingConfig.fromBaseConfig( | |
config: callKeepBaseConfig, | |
uuid: uuid, | |
handle: caller, | |
callerName: caller, | |
hasVideo: isVideo, | |
extra: <String, dynamic>{'userId': userId}, | |
); | |
return await CallKeep.instance.startCall(config); | |
} | |
Future<void> displayIncomingCall( | |
String uuid, | |
bool isVideo, | |
String caller, | |
String userId, | |
) async { | |
final config = CallKeepIncomingConfig.fromBaseConfig( | |
config: callKeepBaseConfig, | |
uuid: uuid, | |
contentTitle: 'Incoming call', | |
hasVideo: isVideo, | |
handle: caller, | |
callerName: caller, | |
extra: <String, dynamic>{'userId': userId}, | |
); | |
return CallKeep.instance.displayIncomingCall(config); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment