You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
I think we should look at what it takes to implement the FileSource object in Java. This would allow us to remove the dependencies on CURL, OpenSSL and libzip, as well as SQLite.
With the FileSource refactor, we can now more easily swap out the storage backends: Either, we replace the FileSource object completely, which leaves us with implementing the FileSource API, which is essentially just a request/cancel method. All the underlying logic, like caching, HTTP requesting and loading from the APK file has to be implemented manually.
We could also replace only part of the API, e.g. only reimplement the HTTP logic in Java. I think we should start with the latter, but potentially move our way up the chain until we have we can get rid of all of these dependencies, especially given that they have Java APIs that use the system's built-in libs.
Looks like we should use Volley. @bleege Are you familiar with Volley?
We looked at Volley for the Android Raster SDK last February and again last Summer. We ultimately decided not to use it as it was a bit murky in terms of documentation / stability (see links).
The Raster SDK currently uses Square's OkHttp for networking. That said we're now leaning towards using the Glide Framework based on some research in January for V4 support. The big reason is that it uses stock Java networking classes but can also make use of Volley and OkHttp if desired and has great caching support.
That said it looks like Google's finally cleaned that those issues with the Tutorial / Overview that you found @ljbade. I'm not also familiar with GL's FileSource object so if you're feeling like Volley would work well for that then it's certainly worth kicking the tires again.
The FileSource object's API is just three functions: a request() function that will request the URL, returns a cancelable Request object, and will run the provided callback in the provided loop. A request() function that only takes a URL and a callback, and will call the callback in an arbitrary thread, and finally a cancel() function that takes a Request object, and is supposed to cancel the request. In terms of the underlying implementation, it does not mandate anything, except that the functions must be threadsafe.
@ljbade and I just had a great discussion on the current state of Android GL and what a solution for this problem would need / look like. This was super helpful to understand what type of content was going to be downloaded, if it needed to be cached, etc as many of the Android networking libraries are tuned to specific features (ex: Glide for downloading and caching images) vs more generic HTTP access like OkHttp.
Based on this info, I think it makes the most sense to investigate OkHttp and Volley for use in GL. OkHttp is a much more widely used in the Android world so it's likely many people using the Android GL SDK will also be using it in their apps. This can be good as it helps keep the overall number of dependencies (and app sizes) down, but it can also be bad especially for people who hardwire the Android GL SDK into their apps (see: Eclipse users).
@bleege any reason we can't just treat everything as opaque binary data? It shouldn't matter to the Java request library what the contents of the files we're requesting are.
@kkaefer Yep, we can do that. In fact the examples I've finished so far all make use of byte arrays and then use native features to make use of them (ImageView and Typeface). The next ones are JSON which is also built in to Android and ProtoBufs, which are probably going to require an additional library (I'm currently leaning towards using Square Wire for this).
That said, the driving reason for looking at these different libraries is that the stock HTTP networking API in Android has some pretty severe limitations with some "highlights" being:
Synchronous only requests that block
SSL handshaking / failover issues
Lack of connection pooling
No automatic GZIP support
I've settled in on OkHttp from Square to build the examples described in previous comments. It gives us everything we need but is strictly HTTP / SPDY client and can provide data in binary format. This is in contrast to most open source libraries that try to solve these issues by also baking in other common addition features like custom JSON Support, Image processing, and POJO Marshaling. Since the GL Core is going to handle all this stuff we don't need it as addition bit weight in a library.
Anyway, here's the link to the my example app on GitHub called OkGL. I"m going to try to finish up the features tomorrow (including cancel support) and then hopefully refactor it to be cleaner / easier to use. Please feel free to check it out and let me know what you think.
Activity
mikemorris commentedon Feb 6, 2015
yes yes yes
ljbade commentedon Feb 6, 2015
Yeah OK I will start looking into what is required on the JNI side to handle two way comms.
ljbade commentedon Feb 8, 2015
Looks like we should use Volley. @bleege Are you familiar with Volley?
As far as JNI goes main thing is to pay attention to object references with local/global scope and ensuring Java attached to any threads.
ljbade commentedon Feb 8, 2015
Also taking a look at using JNI with arrays. A good overview is here. However it does not mention these functions that should be faster.
Some JNI tips from IBM.
Interesting way to remove the need to call Java from native: http://nerds-central.blogspot.com/2012/04/extreme-jni-performance.html
Finally I need to read up on ByteBuffer
bleege commentedon Feb 8, 2015
We looked at Volley for the Android Raster SDK last February and again last Summer. We ultimately decided not to use it as it was a bit murky in terms of documentation / stability (see links).
The Raster SDK currently uses Square's OkHttp for networking. That said we're now leaning towards using the Glide Framework based on some research in January for V4 support. The big reason is that it uses stock Java networking classes but can also make use of Volley and OkHttp if desired and has great caching support.
That said it looks like Google's finally cleaned that those issues with the Tutorial / Overview that you found @ljbade. I'm not also familiar with GL's FileSource object so if you're feeling like Volley would work well for that then it's certainly worth kicking the tires again.
kkaefer commentedon Feb 9, 2015
The FileSource object's API is just three functions: a
request()function that will request the URL, returns a cancelableRequestobject, and will run the provided callback in the provided loop. Arequest()function that only takes a URL and a callback, and will call the callback in an arbitrary thread, and finally acancel()function that takes aRequestobject, and is supposed to cancel the request. In terms of the underlying implementation, it does not mandate anything, except that the functions must be threadsafe.bleege commentedon Feb 10, 2015
@ljbade and I just had a great discussion on the current state of Android GL and what a solution for this problem would need / look like. This was super helpful to understand what type of content was going to be downloaded, if it needed to be cached, etc as many of the Android networking libraries are tuned to specific features (ex: Glide for downloading and caching images) vs more generic HTTP access like OkHttp.
Based on this info, I think it makes the most sense to investigate OkHttp and Volley for use in GL. OkHttp is a much more widely used in the Android world so it's likely many people using the Android GL SDK will also be using it in their apps. This can be good as it helps keep the overall number of dependencies (and app sizes) down, but it can also be bad especially for people who hardwire the Android GL SDK into their apps (see: Eclipse users).
Summary of Discussion:
Current State
Content To Download
** Binary files
Caching
Needs
ljbade commentedon Feb 10, 2015
@bleege spot on summary,
should also add, must support android 2.x if possible -> #555
bleege commentedon Feb 17, 2015
Some other possibilities that have turned up during research:
Comparisons
bleege commentedon Feb 17, 2015
Native API References from @mikemorris.
bleege commentedon Feb 17, 2015
Images and Font demos are done. Next up is Styles.
kkaefer commentedon Feb 18, 2015
@bleege any reason we can't just treat everything as opaque binary data? It shouldn't matter to the Java request library what the contents of the files we're requesting are.
bleege commentedon Feb 18, 2015
@kkaefer Yep, we can do that. In fact the examples I've finished so far all make use of byte arrays and then use native features to make use of them (ImageView and Typeface). The next ones are JSON which is also built in to Android and ProtoBufs, which are probably going to require an additional library (I'm currently leaning towards using Square Wire for this).
That said, the driving reason for looking at these different libraries is that the stock HTTP networking API in Android has some pretty severe limitations with some "highlights" being:
I've settled in on OkHttp from Square to build the examples described in previous comments. It gives us everything we need but is strictly HTTP / SPDY client and can provide data in binary format. This is in contrast to most open source libraries that try to solve these issues by also baking in other common addition features like custom JSON Support, Image processing, and POJO Marshaling. Since the GL Core is going to handle all this stuff we don't need it as addition bit weight in a library.
Anyway, here's the link to the my example app on GitHub called OkGL. I"m going to try to finish up the features tomorrow (including cancel support) and then hopefully refactor it to be cleaner / easier to use. Please feel free to check it out and let me know what you think.
52 remaining items
Use OkHTTP to implement HTTPContext on Android.
jfirebaugh commentedon Jan 6, 2016
We are back on OkHTTP now.
bleege commentedon Jan 6, 2016
Yep, OkHTTP is back via #2400 , #2856 , and #2857 .