podverse / podverse-rn

Podverse mobile app written in React Native for iOS, Android, and F-Droid
https://podverse.fm/about
GNU Affero General Public License v3.0
218 stars 36 forks source link

[FR] Android Headless Start from Android Auto #2206

Open lovegaoshi opened 1 month ago

lovegaoshi commented 1 month ago

Is your feature request related to a problem? Please describe. headless start from android auto without DRAW_OVER_OTHER_APPS

Describe the solution you'd like I think i figured this all out now as I did the migration to media3. Not sure if this is applicable to RNTP 4.1.1/exoplayer2.

Effectively I was wrong that the android service started by Auto doesnt start the JS engine. It does. It's just the view renders do not, plus RNTP forbids background player setup by default. So the trick is to move all player setups and relevant listeners out of any hooks, and move them into index.js instead (for example, inside PlaybackService() of TrackPlayer.registerPlaybackService(() => PlaybackService);). the example app should start headlessly now

This may be fairly tedious if many of the listeners are set up as hooks.

The old DRAW_OVER_OTHER_APPS method is still a dumb plug and play way to enable sorta headless playback.

Describe alternatives you've considered N/A

Additional context N/A

Please feel free to join our Discord and chat with us in the #dev channel if you'd like to work on this.

lovegaoshi commented 1 month ago

my app using this headless fork just passed the google store review.

image