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

[Enhancement] Android TV Support #606

Open
1 task
moozhub opened this issue Feb 25, 2023 · 17 comments
Open
1 task

[Enhancement] Android TV Support #606

moozhub opened this issue Feb 25, 2023 · 17 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@moozhub
Copy link

moozhub commented Feb 25, 2023

Love your app, but it crashes immediately on ATV. Any plans for support on ATV?

Steps to reproduce

  1. Install
  2. Open
  3. Observe crash

Expected behaviour

  • Tell us what should happen

At least open

Actual behaviour

  • Tell us what happens

Crashes immediately

Environment data

Rooted Lineageos 19 kernel version 4.9.113

Audiobookshelf Version: 0.9.62-beta

  • [ X] Android App?
  • iOS App?

Android Issue

Android version: ATV 12

Device model: ODroid-n2+

Stock or customized system: Custom rooted Lineageos 19 ATV 12 on ODroid-n2+

@moozhub moozhub added the bug Something isn't working label Feb 25, 2023
@advplyr
Copy link
Owner

advplyr commented Feb 25, 2023

I don't have an Android TV so not something I would develop at the moment. Someone else may help though.

Are you able to install the app through the play store on your Android TV?

@advplyr advplyr added the help wanted Extra attention is needed label Feb 25, 2023
@moozhub
Copy link
Author

moozhub commented Feb 25, 2023

I don't have an Android TV so not something I would develop at the moment. Someone else may help though.

Are you able to install the app through the play store on your Android TV?

No, the playstore is pretty limited on ATV, but manually downloading the APK and installing it works fine, as far as I know the repositories for a regular Android device and ATV are separate but as far as that I don't know the details around what makes it into the ATV repo.. I can provide the ROM if you're interested in installing it in a virtual environment, or I can try to provide any details you might want.

Thanks for the quick reply

@advplyr
Copy link
Owner

advplyr commented Feb 25, 2023

Got it. If the app was being listed on the Android TV play store then this would be a bug, but since it is not supported at the moment this is a feature request.

Similar to Android Auto we have to declare that this is Android TV compatible then the Google team reviews it.

A developer with an Android TV might come along and help with this.

@advplyr advplyr added enhancement New feature or request and removed bug Something isn't working labels Feb 25, 2023
@advplyr advplyr changed the title Crashes immediately on Android TV 12 [Enhancement] Android TV Support Feb 25, 2023
@moozhub
Copy link
Author

moozhub commented Feb 25, 2023

Got it. If the app was being listed on the Android TV play store then this would be a bug, but since it is not supported at the moment this is a feature request.

Similar to Android Auto we have to declare that this is Android TV compatible then the Google team reviews it.

A developer with an Android TV might come along and help with this.

Here's some info that I gathered that might be of assistance some time in the future..

02-25 15:41:17.419  8711  8711 D AndroidRuntime: Shutting down VM                                                           
02-25 15:41:17.419  8711  8711 E AndroidRuntime: FATAL EXCEPTION: main                                                      
02-25 15:41:17.419  8711  8711 E AndroidRuntime: Process: com.audiobookshelf.app, PID: 8711                                 
02-25 15:41:17.419  8711  8711 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.audiobookshelf.app/com.audiobookshelf.app.MainActivity}: java.lang.RuntimeException: com.google.android.gms.cast.framework.zzat: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module com.google.android.gms.cast.framework.dynamite found. Local version is 0 and remote version is 0.  
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3707)                                                     
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864)                                                      
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)                                          
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)                               
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)                                         
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)                                                           
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)             
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)                      
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)                          
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7870)        
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)                   
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)                                              
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)    
02-25 15:41:17.419  8711  8711 E AndroidRuntime: Caused by: java.lang.RuntimeException: com.google.android.gms.cast.framework.zzat: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module com.google.android.gms.cast.framework.dynamite found. Local version is 0 and remote version is 0.                                                         
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.google.android.gms.cast.framework.CastContext.getSharedInstance(com.google.android.gms:play-services-cast-framework@@20.1.0:8)                                                           
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.player.CastManager.getContext(CastManager.kt:309)                                                       
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.player.CastManager.access$getContext(CastManager.kt:19)                                                 
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.player.CastManager$startRouteScan$callback$1.onRouteUpdate(CastManager.kt:128)                          
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.player.CastManager$ScanCallback.onFilteredRouteUpdate(CastManager.kt:246)                               
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.player.CastManager.startRouteScan(CastManager.kt:152)                                                   
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.plugins.AbsAudioPlayer.initCastManager(AbsAudioPlayer.kt:169)                                           
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.plugins.AbsAudioPlayer.load(AbsAudioPlayer.kt:40)                                                       
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.PluginHandle.loadInstance(PluginHandle.java:115)
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.PluginHandle.load(PluginHandle.java:105)        
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:65)       
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.Bridge.registerPlugin(Bridge.java:627)          
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:583)      
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.Bridge.<init>(Bridge.java:210)                  
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.Bridge.<init>(Unknown Source:0)                 
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.Bridge$Builder.create(Bridge.java:1502)         
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:43)     
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:37) 
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.audiobookshelf.app.MainActivity.onCreate(MainActivity.kt:61) 
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8057)           
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8037)           
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)                                                    
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688)                                                     
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        ... 12 more                                                         
02-25 15:41:17.419  8711  8711 E AndroidRuntime: Caused by: com.google.android.gms.cast.framework.zzat: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module com.google.android.gms.cast.framework.dynamite found. Local version is 0 and remote version is 0.                       
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.google.android.gms.internal.cast.zzm.zzf(com.google.android.gms:play-services-cast-framework@@20.1.0:7)                    
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.google.android.gms.internal.cast.zzm.zza(com.google.android.gms:play-services-cast-framework@@20.1.0:1)                    
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.google.android.gms.cast.framework.CastContext.<init>(com.google.android.gms:play-services-cast-framework@@20.1.0:4)        
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at 
com.google.android.gms.cast.framework.CastContext.getSharedInstance(com.google.android.gms:play-services-cast-framework@@20.1.0:7)                                                           
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        ... 34 more                                                         
02-25 15:41:17.419  8711  8711 E AndroidRuntime: Caused by: com.google.android.gms.dynamite.DynamiteModule$LoadingException: No acceptable module com.google.android.gms.cast.framework.dynamite found. Local version is 0 and remote version is 0.     
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.google.android.gms.dynamite.DynamiteModule.load(com.google.android.gms:play-services-basement@@18.0.0:65)                  
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        at com.google.android.gms.internal.cast.zzm.zzf(com.google.android.gms:play-services-cast-framework@@20.1.0:2)                    
02-25 15:41:17.419  8711  8711 E AndroidRuntime:        ... 37 more                                                         
02-25 15:41:17.425  3639  3665 W ActivityTaskManager:   Force finishing activity com.audiobookshelf.app/.MainActivity

Some of that might not be relevant, there's a lot of stuff in my log so apologies.

@moozhub
Copy link
Author

moozhub commented Feb 25, 2023

Updated to look prettier

@advplyr
Copy link
Owner

advplyr commented Feb 25, 2023

Thanks, the error makes sense since we have not declared a TV activity. https://developer.android.com/training/tv/start/start#tv-activity

@moozhub
Copy link
Author

moozhub commented Feb 25, 2023

Thanks, the error makes sense since we have not declared a TV activity. https://developer.android.com/training/tv/start/start#tv-activity

Cool, looks like that is a start. I can test any updates you might want to throw at me. Thanks for the efforts.

@galaxyfar
Copy link

galaxyfar commented Feb 26, 2023

FYI, ran into the exact same issue on one of my Android TV last week.

After dumping the log and looking around of answers, I figured instant crash was happening due to outdate Google play services. Sideloaded latest play services apk and everything works like a charm, no more crash.

This issue is not ATV per se but specific to certain ATV devices because same app works right out of the box on Nvidia shield TV.

@moozhub
Copy link
Author

moozhub commented Feb 28, 2023

FYI, ran into the exact same issue on one of my Android TV last week.

After dumping the log and looking around of answers, I figured instant crash was happening due to outdate Google play services. Sideloaded latest play services apk and everything works like a charm, no more crash.

This issue is not ATV per se but specific to certain ATV devices because same app works right out of the box on Nvidia shield TV.

Are you using the Google play services for ATV? What version of ATV are you using (what Android version) and what play services version did you sideload? I'll give it a shot.

Thanks

@galaxyfar
Copy link

Android TV in question was running Android 11. It's el cheapo Google certified TV box from Mecool, came preinstalled with Google play services/store but for some reason was not getting any apps updates from Play store and ABS app was not even showing up.

So I just sideloaded google-play-services-23-06-16-040400-510240997.apk from apkmirror and voila, it all started working.

@moozhub
Copy link
Author

moozhub commented Feb 28, 2023

Android TV in question was running Android 11. It's el cheapo Google certified TV box from Mecool, came preinstalled with Google play services/store but for some reason was not getting any apps updates from Play store and ABS app was not even showing up.

So I just sideloaded google-play-services-23-06-16-040400-510240997.apk from apkmirror and voila, it all started working.

I see.

I think what you did was sideloaded the regular Google play services (the one for mobile devices, and not the one for ATV). If that's what you did that would make sense that it shows up in the playstore after you installed it, since the device you installed it on is no longer being registered with the play store as an ATV device, but as a mobile device.

While I'm not sure of all the repercussions of that I do know that the device you installed it on is technically no longer an ATV device (at least from the perspective of the apps you install, and some features potentially may not function the way you would expect).

I still may try it just to play around with it but having the software installed on ATV using ATV play services and ATV playstore would be most ideal.

@nathanmilot
Copy link

I was able to sideload it and open the app, but navigation doesn't work properly. It only selects the main section headings but is missing the ability to actually select audiobooks or navigate to the player. Might try to take a stab at it at some point if I get any time.

https://developer.android.com/training/tv/start/navigation

@advplyr
Copy link
Owner

advplyr commented Sep 13, 2023

@nathanmilot I haven't looked into this yet but peeking at those docs I don't see anything about controlling navigation using WebView. The UI of the app is WebView so it can be shared between android and ios. It may be as easy as implementing tabindexes

@nathanmilot
Copy link

Oh nice. Yeah hadn't looked at the codebase too in depth.

@coldshouldermedia
Copy link

coldshouldermedia commented Nov 28, 2023

I would love to see support for this as well, unofficial is fine by me as well since it's easy to sideload.

After sideloading the ABS android app (V0.9.68) onto my Chromecast with TV, I had the same navigation issues. The setup is easy to replicate on an android device by just connecting a keyboard and navigating using the arrow keys/enter. It's already seems close to working!

I'm not sure if anyone's made a note of this, but adding this functionality does have some accessibility potential as well by giving an alternative method of navigation.

@steve1123456
Copy link

steve1123456 commented Feb 19, 2024

I was able to sideload it and open the app, but navigation doesn't work properly. It only selects the main section headings but is missing the ability to actually select audiobooks or navigate to the player. Might try to take a stab at it at some point if I get any time.

https://developer.android.com/training/tv/start/navigation

This! I'm in the same boat. Can login but can't scroll to books.

A workaround I've found is to install a Mouse app, which actually works and does the job, but it's a bit clunky. Would be ideal to simply click down on the firestick and navigate around the books.

Fantastic app by the way!

@colvdv
Copy link

colvdv commented Mar 6, 2024

A workaround I've found is to install a Mouse app, which actually works and does the job, but it's a bit clunky.

I too found a workaround: Accessing through Silk Browser.

I then installed Bookmarker to bookmark the page for quick access. Navigation isnt the most convenient, scrolling for example must be done by clicking on the scroll bar, but it works.

This isn't too much hassle for me, but I have grandparents that I'm looking out for and easier navigation makes a world of difference for them. Doing my best to give them alternatives for entertainment to the BS on TV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants