Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass information from didDisplayIncomingCall to Flutter app? #25

Open
jaween opened this issue May 18, 2022 · 1 comment
Open

Comments

@jaween
Copy link

jaween commented May 18, 2022

I am using this plugin to successfully trigger the CallKit ringing UI upon receiving a PushKit voip notification.

This plugin says to handle the incoming call using the FCXPlugin.didDisplayIncomingCall field in Dart. Answering the call launches the Flutter app UI, but the FCXPlugin.didDisplayIncomingCall function never runs. Interestingly the performAnswerCallAction does run.

I have been unsuccessful in passing information from that function into the Flutter app. I have tried writing and flushing it to disk, as well as SharedPreferences, but the data doesn't appear to be written upon app launch, it is only available in subsequent app launches. I am pretty confused. What is the suggested approach here?

Plugin version: 2.0.2+2

Flutter doctor output
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-x64, locale en-AU)
    • Flutter version 2.10.5 at /opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5464c5bac7 (4 weeks ago), 2022-04-18 09:55:37 -0700
    • Engine revision 57d3bac3dd
    • Dart version 2.16.2
    • DevTools version 2.9.2

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/jaween/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.67.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.40.0

[✓] Connected device (3 available)
    • Jaween’s iPhone (mobile) • 02669b794c29bb14a717a3d0987dc6c5c116d819 • ios            • iOS 15.4.1 19E258
    • macOS (desktop)          • macos                                    • darwin-x64     • macOS 12.3.1 21E258 darwin-x64
    • Chrome (web)             • chrome                                   • web-javascript • Google Chrome 101.0.4951.64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
@jaween
Copy link
Author

jaween commented May 21, 2022

I have solved my immediate issue now. When PushKit receives a voip notification, it launches your app fully in the background, even before the user answers a call.

This includes building the first route of your widget tree, and running initState on the widgets, etc. I was under the impression that the native part of the app would be running, but the Flutter part would launch after answering. This explains why writing to disk/shared preferences didn't produce any results until the next launch: I was reading before I was writing.

However the FCXPlugin.didIncomingCall function still does not get called. I am running my calling logic from the performAnswerCallAction method of the FCXProvider instance instead.

I will leave this as an open issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant