feat: Add Apple CarPlay support#1480
feat: Add Apple CarPlay support#1480GodlySoftware wants to merge 6 commits intoUnicornsOnLSD:redesignfrom
Conversation
- Add CarPlay entitlements and scene configuration to iOS project - Create CarPlaySceneDelegate for handling CarPlay lifecycle - Implement CarPlayHelper service reusing AndroidAutoHelper logic - Add CarPlay method channel bridge between Flutter and native iOS - Update MusicPlayerBackgroundTask to notify CarPlay of track changes - Configure CarPlay templates for Browse, Now Playing, and Search Closes UnicornsOnLSD#24
|
Hi! I noticed this was a requested feature, so I implemented CarPlay support in PR #1480. Happy to make any adjustments based on feedback! |
|
I'll already use this version on my car for sure! Thank you! |
GodlySoftware
left a comment
There was a problem hiding this comment.
The conflict merged:
- Original code: Updated error handling and FlutterImplicitEngineDelegate
- CarPlay code: Added CarPlay import, method channel setup, and delegate method
- Fixed: Missing brace and proper plugin registration
- Implement CarPlay integration with native iOS templates - Fix BaseItemDto.getImageUrl() error using JellyfinApiHelper - Add CarPlay helper service and scene delegate - Update Info.plist with CarPlay configuration
- Fix addListener/removeListener errors by using QueueService stream API - Add missing updateNowPlaying() public method for background task - Replace listener pattern with StreamSubscription for proper cleanup - Add dart:async import for StreamSubscription type
- Add setExcludeFromiCloudBackup function to AppDelegate.swift - Resolves Swift compiler error for iOS build - Function excludes app directories from iCloud backup as intended
|
Updated with fixes for all build errors:
Resolves #24 |
The new section covers: - **CarPlay Simulator Testing** - How to test in Xcode - **Physical CarPlay Testing** - Requirements for real testing - **Development Notes** - Technical implementation details - **Production Requirements** - Apple's requirements for App Store
APIUM
left a comment
There was a problem hiding this comment.
I'm keen for this feature so I had a quick review and added a few comments. Thanks for your work
| @@ -0,0 +1,104 @@ | |||
| # Apple CarPlay Implementation for Finamp | |||
There was a problem hiding this comment.
Suggest just having this in the PR message on GitHub, not committed.
There was a problem hiding this comment.
Yes, this seems like a agent summary? Part of this (requirements, etc.) should be moved into CONTRIBUTING.md as part of the developer docs, another part (testing instructions) should be added to the PR description, and the file structure stuff can probably be deleted entirely
| #### Production CarPlay Requirements | ||
| - Apple Developer Program membership required | ||
| - CarPlay entitlement must be requested from Apple | ||
| - App Store review process includes CarPlay-specific approval### Developing on an Android Device without Android Studio on linux (not recommended) |
| } | ||
|
|
||
| private func notifyFlutter(event: String) { | ||
| guard let flutterViewController = UIApplication.shared.delegate?.window??.rootViewController as? FlutterViewController else { |
|
|
||
| final _androidAutoHelper = GetIt.instance<AndroidAutoHelper>(); | ||
| final _queueService = GetIt.instance<QueueService>(); | ||
| final _audioServiceHelper = GetIt.instance<AudioServiceHelper>(); |
| <dict> | ||
| <key>UISceneConfigurationName</key> | ||
| <string>CarPlay</string> | ||
| <key>UISceneDelegateClassName</key> |
There was a problem hiding this comment.
Unless I'm reading the docs wrong this is also iOS13 or above.
And does the value not need the module name?
| _ application: UIApplication, | ||
| didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
| ) -> Bool { | ||
| GeneratedPluginRegistrant.register(with: self) |
There was a problem hiding this comment.
Already done in didInitializeImplicitFlutterEngine? Does carplay need this here as well for some reason? Does it cause issues on the normal version?
I also don’t have a Mac but I’ve got an iPhone and a CarPlay head unit, I was hoping to borrow a Mac next week to give it a try (but it’s not guaranteed). If I manage to I’ll take some photos/videos as well so everyone can see what it looks like. |
|
@Chaphasilor I have got and set up a Mac to continue this, was able to get a build completed to test that the changes haven't broken the non-carplay portion (they have, it crashes on load), but apparently need a developer account and the CarPlay entitlement just to test it (!). I am willing to get a developer account as that appears to be the main barrier to getting this feature out, but I expect I'll need assistance to secure the entitlement (I expect I won't be able to submit the request from my account, I'm hoping I will be able to build and test once we've got it without being part of the team, but there's a chance I might) - see this link https://developer.apple.com/documentation/carplay/requesting-carplay-entitlements Is this something the team is happy to do? EDIT: It wasn't that difficult to get it to run on my device (still w/o CarPlay testing, but building with the code) with this change https://github.com/APIUM/finamp/tree/pr-1480-carplay . It does make me worry that possibly @GodlySoftware never built this? Are you willing to do any more work on this @GodlySoftware or should any changes needed be picked up by the Finamp team/others? EDIT2: Was able to get it tested on the sim, I can't get any content to load on the Now Playing screen, or for any content to appear when opening the app on CarPlay. I just get a blank screen. The main error that appears in console is |
|
@Peet809178 I've stopped working on testing this PR at the moment, I couldn't get it to work at all on the CarPlay sim. |
|
@GodlySoftware since no-one was able to test this PR so far, and there has been testing with simulators and actual hardware for the other PR (#1516), are you okay with us closing this PR in favor of the other one? |
Closes #24
Changes
This PR implements Apple CarPlay support for Finamp by leveraging the existing Android Auto infrastructure. The implementation includes:
iOS Native Integration:
Flutter Integration:
Key Benefits:
Todo before merging
Related Issues