-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Load map resources from local assets #579
Comments
Found Context.getPackageCodePath that may allow the C++ code to read styles directly from the APK zip file if we include C++ zip library. Also I am going to restrict Assetbridge to extract only the files we need. This should make things faster. See #585 |
Cache shaders: #588 |
Also getCodeCacheDir sounds useful:
But it is only on Android 5+ |
OK de1f37f includes the stuff to limit which files are extracted. |
@kkaefer what would be required to get the URL styles to load directly from a zip file? This would save extacting all the styles even if you are not using all of them Also need to get curl to read the ca-bundle file from the zip too. |
Okay it looks like libzip is the way to go. |
@kkaefer is that OK? |
OK that will not work with relative files, instead I will just use |
Implemented Now I need to get curl to load ca-bundle from memory. See http://curl.haxx.se/libcurl/c/cacertinmem.html and http://blog.steffenl.com/2013/02/load-certificate-from-memory-using-curl.html |
Implemented loading CA bundle from memory: 80be6c4 I removed Assetbridge now that we no longer need it. Done. |
+1 on I refrained from implementing the certificate loading from memory since it requires OpenSSL headers, which we don't necessarily have available on all platform, and I didn't want to add a direct dependency on it, as compiling OpenSSL can get quite hairy. |
Just discovered that Android actually has a native version of the AssetManager in <android/asset_manager.h> so I might be able to get rid of libzip. Reopening. @kkaefer no specific reason for it to be Android specific. I can refactor it to allow other platforms to implement it. Interesting about OpenSSL headers. Perhaps we can just make it an @springmeyer was looking at switching from OpenSSL to Google's BoringSSL fork at least for Android. This is needed as OpenSSL has a compile bug on ARM Android that Google patched in their fork. |
Looks like NDK AssetManager has some flaws. Will keep using libzip. |
I will get android-mason branch merged, then I can come back and expand @incanus do you think |
To make sure I understand, the idea is to use This is easy enough to do as a layer on top of mapbox-gl-native/macosx/main.mm Line 103 in 51c3224
|
Yeah that is what I understand from @kkaefer Ensures same style JSON can be used on both Android and iOS |
Working on |
@incanus I have refactored asset_request to use the cross platform pattern. Currently Linux, OSX and iOS use a noop implementation that just returns a 500 error. So you will need to copy this and add as necessary to load from iOS. |
Note that we'll also have to figure out a way to handle |
Hmm, yes. Perhaps just remap |
Ok @ljbade what else are we working on here to "make the app faster"? We should rename the ticket if nothing else or else split off into separate, actionable, assignable tickets. Right now for example we're discussing |
@incanus I renamed the issue, is that better? Anyway this issue was more about the Android implementation of Now Android is done with asset URL we should close this and have seperate tickets for asset support on other platforms? |
Nah let's do this since it's a single issue thing now:
|
I think we should merge
|
👍 |
👍 to merging into |
Okay will work on this then. |
refs #579: Android can now rename AssetRequest to FileRequest and implement it differently
@ljbade merged this. You can now move the Android implementation to the new scheme. |
@kkaefer awesome |
@kkaefer So where did this get to? I think Android was done right? |
This is implemented in other systems as well. OS X and iPhone bundles load data from the resources folder, Linux builds well load assets relative to the binary's location |
Currently takes the app a second or two to load.
This is due to extracting the asset folder from APK.
Need to make this faster, get rid of it (by reading directly from APK), or only do it once at install time (can hook this), or only if the files are not there.
TODO: more detail on this so you guys understand what I am talking about
The text was updated successfully, but these errors were encountered: