flutter_callkit_incoming icon indicating copy to clipboard operation
flutter_callkit_incoming copied to clipboard

[Android] - Unable to hide incoming call notification/vibration stays on

Open kamilkarp opened this issue 8 months ago • 1 comments

Either hiding incoming notification doesnt work or Im doing something wrong.

Reproducing in examle:

  • add button in home page to hide incoming notification
  • create handler for this button hideIncoming

Im looping for all notification to make sure all of them will hide

  Future<void> hideIncoming() async {
    final allCalls =
        await FlutterCallkitIncoming.activeCalls() as List<dynamic>;

    for (final call in allCalls) {
      final id = call['id'] as String?;

      if (id == null) {
        continue;
      }

      final callKitParams = CallKitParams(id: id);

      try {
        await FlutterCallkitIncoming.hideCallkitIncoming(callKitParams);
        // await FlutterCallkitIncoming.endCall(id);
      } catch (e) {
        print('Error: $e');
      }
    }
  }

Doesnt work with or without .endCall.

Now, click make fake incoming call, notification is shown and click hideIncoming button. Hiding this notification works only for the first time. Next incoming calls wont be hidden. Next time, only ringing sound is stopped, but the vibration and notification stays on. Only restart of the app helps.

kamilkarp avatar Jun 11 '24 12:06 kamilkarp