Jump to content

Using the java API


phillyfan1138

Recommended Posts

phillyfan1138

I am trying to create a more robust client in java instead of in python to run on a computer (not android).  I have tried to use the api https://github.com/MediaBrowser/MediaBrowser.ApiClient.Java.   However after several hours of playing with the API I am not getting very far...even when I try the sample code in the readme isn't working.  The class "volleyHttpClient" appears to be in the Android section and won't compile.  

 

Is there any any other samples or documentation available that I can use?  Thanks in advance.

 

 

Link to comment
Share on other sites

let me go through those examples and see if they need to be brought up to date, and then i'll update. 

Link to comment
Share on other sites

Ok, I've updated the readme. Our new android tv app is actually a great source of sample code. It uses the ConnectionManager class to manage multiple server connections, where each server is managed with an ApiClient class. Here is the connectivity code for that app:

 

https://github.com/MediaBrowser/MediaBrowser.AndroidTv/blob/master/MediaBrowserTv/app/src/main/java/tv/emby/embyatv/startup/StartupActivity.java#L136

 

For pure java usage, there is still some work to be done and maybe you can help. Specifically, we have several interface classes that aren't implemented. At minimum, we need a pure Java implementation of IAsyncHttpClient, probably using HttpUrlConnection. For android I decided to build this around volley instead since that is a very popular library. I have not yet built a pure java version of that class, but it only has a single method that has to be be written so it's not difficult.

 

If you implement that then ti will allow you to create an ApiClient to talk to a single server. If you want to use IConnectionManager, then INetworkConnection will also have to be supplied. I just haven't had a chance to look into how we would do pure java version.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...