ZegoUIKitPrebuiltCallInvitationService class
To receive the call invites from others and let the calling notification show on the top bar when receiving it, you will need to initialize the call invitation service (ZegoUIKitPrebuiltCallInvitationService) first.
1.1 Set up the context. To make the UI show when receiving a call invite, you will need to get the Context. To do so, do the following 3 steps: 1.1.1 Define a navigator key. 1.1.2 Set the navigatorKey to ZegoUIKitPrebuiltCallInvitationService. 1.1.3 Register the navigatorKey to MaterialApp.
1.2 Initialize/Deinitialize the call invitation service. 1.2.1 Initialize the service when your app users logged in successfully or re-logged in after an exit. 1.2.2 Deinitialize the service after your app users logged out.
Example:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
/// 1.1.1 define a navigator key
final navigatorKey = GlobalKey<NavigatorState>();
/// 1.1.2: set navigator key to ZegoUIKitPrebuiltCallInvitationService
ZegoUIKitPrebuiltCallInvitationService().setNavigatorKey(navigatorKey);
runApp(MyApp(navigatorKey: navigatorKey));
}
class MyApp extends StatefulWidget {
final GlobalKey<NavigatorState> navigatorKey;
const MyApp({
required this.navigatorKey,
Key? key,
}) : super(key: key);
@override
State<StatefulWidget> createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
if (/*the user of the app is logged in*/) {
onUserLogin();
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
/// 1.1.3: register the navigator key to MaterialApp
navigatorKey: widget.navigatorKey,
...
);
}
}
/// on App's user login
void onUserLogin() {
/// 1.2.1. initialized ZegoUIKitPrebuiltCallInvitationService
/// when app's user is logged in or re-logged in
/// We recommend calling this method as soon as the user logs in to your app.
ZegoUIKitPrebuiltCallInvitationService().init(
appID: yourAppID /*input your AppID*/,
appSign: yourAppSign /*input your AppSign*/,
userID: currentUser.id,
userName: currentUser.name,
plugins: [ZegoUIKitSignalingPlugin()],
);
}
/// on App's user logout
void onUserLogout() {
/// 1.2.2. de-initialization ZegoUIKitPrebuiltCallInvitationService
/// when app's user is logged out
ZegoUIKitPrebuiltCallInvitationService().uninit();
}
Constructors
- ZegoUIKitPrebuiltCallInvitationService()
-
factory
Properties
- androidNotificationConfig → ZegoAndroidNotificationConfig?
-
no setter
- controller → ZegoUIKitPrebuiltCallController?
-
no setter
- events → ZegoUIKitPrebuiltCallInvitationEvents?
-
Invitation-related event notifications and callbacks.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- innerText → ZegoCallInvitationInnerText
-
no setter
- isInCalling → bool
-
no setter
- isInit → bool
-
no setter
- ringtoneConfig → ZegoRingtoneConfig
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
didChangeAppLifecycleState(
bool isAppInBackground) → void -
init(
{required int appID, required String appSign, required String userID, required String userName, required List< IZegoUIKitPlugin> plugins, PrebuiltConfigQuery? requireConfig, ZegoUIKitPrebuiltCallInvitationEvents? events, ZegoUIKitPrebuiltCallController? controller, ZegoCallInvitationInnerText? innerText, ZegoRingtoneConfig? ringtoneConfig, ZegoCallInvitationUIConfig? uiConfig, bool showDeclineButton = true, bool showCancelInvitationButton = true, bool notifyWhenAppRunningInBackgroundOrQuit = true, ZegoAndroidNotificationConfig? androidNotificationConfig, ZegoIOSNotificationConfig? iOSNotificationConfig, ZegoSignalingPluginMultiCertificate certificateIndex = ZegoSignalingPluginMultiCertificate.firstCertificate, String appName = '', bool? isIOSSandboxEnvironment}) → Future<void> -
isOpeningAppByCallInvitation(
) → Future< bool> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
- we need a context object, to push/pop page when receive invitation request so we need navigatorKey to get context
-
toString(
) → String -
A string representation of this object.
inherited
-
uninit(
) → Future< void> -
useSystemCallingUI(
List< IZegoUIKitPlugin> plugins) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited