From 276f73f7bb8ef09ff3a823e8fcf6adb0952fef31 Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Wed, 16 Jun 2021 12:03:11 +0800 Subject: [PATCH] Fix that the call list cannot be displayed when the push is received when andorid is running. --- example/lib/main.dart | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 60f6598..7bad467 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -324,9 +324,17 @@ class _MyAppState extends State { print('onMessage: $message'); if (message.containsKey('data')) { // Handle data message - final dynamic data = message['data']; - var number = data['body'] as String; - await displayIncomingCall(number); + var payload = message['data']; + var callerId = payload['caller_id'] as String; + var callerName = payload['caller_name'] as String; + var uuid = payload['uuid'] as String; + var hasVideo = payload['has_video'] == "true"; + final callUUID = uuid ?? Uuid().v4(); + setState(() { + calls[callUUID] = Call(callerId); + }); + _callKeep.displayIncomingCall(callUUID, callerId, + localizedCallerName: callerName, hasVideo: hasVideo); } }, onBackgroundMessage: myBackgroundMessageHandler,