- Get API_SID_KEY, API_SECRET_KEY of project from Console Stringee and create
config.jsonlike config.sample.json. And run flutter project withflutter run --dart-define-from-file=config.json - Configure PUSH to receive call when app not foreground if needed.
The StringeeWrapper class serves as a singleton interface to interact with the Stringee API for handling voice and video calls. This documentation provides an overview of its properties, methods, and usage.
- Returns the singleton instance of
StringeeWrapper.
- Type:
StringeeListener? - Description: Getter for
_stringeeListener.
- Type:
int - Description: Timeout for a call, default is 60 seconds.
- Type:
bool - Description: Indicates if the client is connected to the Stringee server.
void configure({int callTimeOut = 60})- Description: Configure properties for call.
- Parameters:
callTimeOut(int): Time out for call if have no interaction in seconds. Default is 60- more properties can be added here later
Future<void> connect(String token) async- Description: Connects to the Stringee server using the provided token.
- Parameters:
token(String): The token of the user.
Future<void> disconnect() async- Description: Disconnects from the Stringee server.
Future<bool> enablePush({bool? isProduction, bool? isVoip}) async- Description: Enables push to receive notification incoming calls when app is in background. Check more on Receive Push
- Parameters:
isProduction(bool?, optional): Indicates if the push is for production. Defaults tokReleaseMode.isVoip(bool?, optional): Indicates if the push is for VoIP.
Future<bool> unregisterPush() async- Description: Unregisters push notifications.
Future<void> makeCall({
required String from,
required String to,
bool isVideoCall = false,
Map<dynamic, dynamic>? customData,
VideoQuality? videoQuality,
}) async- Description: Makes a call to the specified user.
- Parameters:
from(String): The caller ID.to(String): The callee ID.isVideoCall(bool, optional): Indicates if the call is a video call. Defaults tofalse.customData(Map<dynamic, dynamic>?, optional): Custom data for the call.videoQuality(VideoQuality?, optional): Quality of the video.
Future<void> addListener(StringeeListener listener) async- Description: Adds a listener to listen to events from
StringeeWrapper. - Parameters:
listener(StringeeListener): The listener to listen to events.
The StringeeListener class is a listener for handling various events from the StringeeWrapper.
- Type:
Function() - Description: Callback function called when the client is connected to Stringee server.
- Type:
Function() - Description: Callback function called when the client is disconnected to Stringee server.
- Type:
Function() - Description: Callback function called when the token is expired, you should call connect with new token.
- Type:
Function(Map<dynamic, dynamic> event)? - Description: Optional callback function called when the client receives call information.
- Type:
Function(Map<dynamic, dynamic> event)? - Description: Optional callback function called when the client receives a custom message.
- Type:
Function(int code, String message) - Description: Callback function called when the client encounters an error.
- Type:
Function(Widget callWidget) - Description: Callback function called when the client should present a call widget.
- Type:
Function(String message) - Description: Callback function called when the client should dismiss a call widget.
To receive incoming calls when app on background/terminated, you have to enable push. To handle it, StringeeWrapper using:
- iOS: CallKit and PushKit
- Android: FCM
NOTE: When push was enabled, your app should call connect as soon as possible to receive incoming call from Stringee.
iOS: ONLY WORKING ON REAL DEVICE, not on simulator(Callkit framework not working on simulator)
Follow steps in Push Notification. Some steps can be skipped if not necessary or already implemented