-
-
Notifications
You must be signed in to change notification settings - Fork 62
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 open flutter carplay with proper data without opening app? #56
Comments
Hi, @richanshah. I managed to find the solution to this issue with the comment at this link #12 (comment) -1150229720 |
OK, Thanks I will give it a try. |
@richanshah did you have any luck with the solution in the link provided? I was not able to get it working. |
@derrik-fleming The main idea is to move the FlutterEngine creation to the AppDelegate, which will be run when the app is launched from anywhere (CarPlay or device). We can run the FlutterEngine in headless mode, so the dart code can run before the engine is attached to any actual view (which happens when launching the app first on the CarPlay). Then, on the SceneDelegate we reuse the engine and attach it to the actual view. So the AppDelegate.swift will be like this: import UIKit let flutterEngine = FlutterEngine(name: "SharedEngine", project: nil, allowHeadlessExecution: true) @UIApplicationMain
} @available(iOS 13.0, *)
} func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene,
} |
I tried above code but it is not working for me. |
@viniciusoliverrs I was able to get it working. But I have a question about something that doesn't seem to be working in the same way as it does when the app is launched from the mobile device. Do you know how I could get an accurate value for |
Steps to reproduce
Open app in carplay and mobile device both
Play any song from carplay
Kill the app from mobile and observe that carplay app also stopped
Now open the app in carplay only
Observe
You will see "Please wait while data fetching" on collections, playlists and songs screen when you kill the app and then open app in carplay
Also this happens when you close the app and go back into the app in carplay only then click music you just get spinning.
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.2.1 23C71 darwin-arm64 (Rosetta), locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
The text was updated successfully, but these errors were encountered: