hiennguyen92 / flutter_callkit_incoming

Flutter Callkit Incoming
https://pub.dev/packages/flutter_callkit_incoming
MIT License
165 stars 264 forks source link

Duplicate missed call notifications #533

Open paramaw opened 3 months ago

paramaw commented 3 months ago

When a miss call happens, it shows duplicate notifications.

You can see this in the existing example app.

However, if I comment out the avatar field, it works fine.

Here's the exact location of the file

  Future<void> makeFakeCallInComing() async {
    await Future.delayed(const Duration(seconds: 1), () async {
      _currentUuid = _uuid.v4();

      final params = CallKitParams(
        id: _currentUuid,
        nameCaller: 'Hien Nguyen',
        appName: 'Callkit',
        // avatar: 'https://i.pravatar.cc/100', -- if this is commented out, no bug occurs.
        handle: '0123456789',
        type: 0,
        duration: 30000,
        ...
        ),
      );
      await FlutterCallkitIncoming.showCallkitIncoming(params);
    });
  }
tgh1701 commented 3 months ago

Same issue

deepakSoftRadixNew commented 3 months ago

Same issue

sunil-singh-chaudhary commented 1 month ago

did you find any solution when call is missed getting duplicate notification help pls

sunil-singh-chaudhary commented 1 month ago

hi ,

this is my code

class CallUtils { static Future showIncomingCall(var body) async { Uuid uuid = const Uuid(); String currentUuid = uuid.v4();

String defaultImage = 'https://i.pravatar.cc/500';
String? profilePic = body['profile'];

String imageUrl;
if (profilePic != null) {
  imageUrl = imgBaseurl + profilePic;
} else {
  imageUrl = defaultImage;
}
bool calltype = body['call_type'] == 10; //video call or audio call

log('calltype is  $calltype');

CallKitParams callKitParams = CallKitParams(
  id: currentUuid,
  nameCaller: body['name'] ?? 'User',
  appName: 'appname',
  handle: 'appname Partner',
  // avatar: imageUrl,
  type: calltype ? 1 : 0, 
  textAccept: 'Accept',
  textDecline: 'Decline',
  duration: 30000,
  missedCallNotification: const NotificationParams(
    showNotification: true,
    isShowCallback: true,
    subtitle: 'Missed call',
    callbackText: 'Call back',
  ),
  extra: <String, dynamic>{
    'call_type': body['call_type'],
    'notificationType': body['notificationType'],
    'callId': body['callId'],
    'profile': body['profile'],
    'name': body['name'],
    'id': body['id'],
    'fcmToken': body['fcmToken'],
    'call_duration': body['call_duration'].toString(),
  },

  headers: <String, dynamic>{'apiKey': 'sunil@123!', 'platform': 'flutter'},
  android: const AndroidParams(
    isCustomNotification: true,
    isShowLogo: true,
    ringtonePath: 'system_ringtone_default',
    backgroundColor: '#0955fa',
    actionColor: '#4CAF50',
    textColor: '#ffffff',
    incomingCallNotificationChannelName: "Incoming Call",
    isShowCallID: true,
  ),
);

await FlutterCallkitIncoming.showCallkitIncoming(callKitParams);

} } if i add this line avatar: imageUrl, then duplicate notification is showing when call is missed but when i removed this avatar field then i am getting one notification which is correct i think the culprit here is avatar , anybody have any idea how to resolve this i want to show avatar too how can i do this

itsdani121 commented 1 week ago

@sunil-singh-chaudhary are you found any solution ? i am also ffaciing this issue. also custom notification didinot get name and body of text in android but when it false then it works fine.

sunil-singh-chaudhary commented 1 week ago

no nothing yet

@sunil-singh-chaudhary are you found any solution ? i am also ffaciing this issue. also custom notification didinot get name and body of text in android but when it false then it works fine.