Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Load map resources from local assets #579

Closed

Description

@ljbade

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

Activity

  1. added
    Android
    on Nov 9, 2014
  2. ljbade commented on Nov 11, 2014

    @ljbade
    ContributorAuthor

    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

  3. kkaefer commented on Nov 11, 2014

    @kkaefer
    Member

    Cache shaders: #588

  4. ljbade commented on Nov 11, 2014

    @ljbade
    ContributorAuthor

    Also getCodeCacheDir sounds useful:

    Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code. The system will delete any files stored in this location both when your specific application is upgraded, and when the entire platform is upgraded.

    But it is only on Android 5+

  5. ljbade commented on Nov 11, 2014

    @ljbade
    ContributorAuthor

    OK de1f37f includes the stuff to limit which files are extracted.

  6. added
    performance
    on Nov 16, 2014
  7. ljbade commented on Nov 17, 2014

    @ljbade
    ContributorAuthor

    @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.

  8. ljbade commented on Nov 17, 2014

    @ljbade
    ContributorAuthor

    Okay it looks like libzip is the way to go.

  9. ljbade commented on Nov 17, 2014

    @ljbade
    ContributorAuthor

    I am proposing a URL scheme like: zip://path/to/zipfile#path/in/zipfile

    @kkaefer is that OK?

  10. ljbade commented on Nov 17, 2014

    @ljbade
    ContributorAuthor

    OK that will not work with relative files, instead I will just use asset://path/to/file which means we will load from the APK's assets dir.

  11. ljbade commented on Nov 17, 2014

    @ljbade
    ContributorAuthor

    Implemented loading CA bundle from memory: 80be6c4

    I removed Assetbridge now that we no longer need it.

    Done.

  12. kkaefer commented on Nov 24, 2014

    @kkaefer
    Member

    +1 on asset:// URLs. Why make it Android-specific though? This will make stylesheets that use that URL scheme platform specific. Instead, we could use this scheme to provide a couple of default styles/sprites/fonts that always ship with all applications.

    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.

  13. ljbade commented on Nov 24, 2014

    @ljbade
    ContributorAuthor

    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 #ifdef that is set on platforms that have OpenSSL headers and want to load certs from asset://?

    @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.

  14. 11 remaining items

  15. ljbade commented on Dec 2, 2014

    @ljbade
    ContributorAuthor

    @incanus I renamed the issue, is that better?

    Anyway this issue was more about the Android implementation of asset://, but that has now grown to cross-platform concept.

    Now Android is done with asset URL we should close this and have seperate tickets for asset support on other platforms?

  16. incanus commented on Dec 2, 2014

    @incanus
    Contributor

    Nah let's do this since it's a single issue thing now:

  17. removed
    Android
    on Dec 2, 2014
  18. kkaefer commented on Dec 5, 2014

    @kkaefer
    Member

    I think we should merge FileRequest and AssetRequest, and move the actual implementation to a platform-specific file, like HTTPRequest already does (it uses Cocoa stuff on OS X/iOS, and CURL on all other platforms).

    FileRequest and AssetRequest are already very similar: relative paths in a file:// URLS are relative to the executable or bundle (iOS/OS X), which means they are already used to access "bundled" files like the stylesheet or image sprites.

  19. jfirebaugh commented on Dec 5, 2014

    @jfirebaugh
    Contributor

    👍

  20. mikemorris commented on Dec 5, 2014

    @mikemorris
    Contributor

    👍 to merging into FileRequest with platform-specific implementations

  21. ljbade commented on Dec 6, 2014

    @ljbade
    ContributorAuthor

    Okay will work on this then.

  22. kkaefer commented on Dec 17, 2014

    @kkaefer
    Member

    @ljbade merged this. You can now move the Android implementation to the new scheme.

  23. ljbade commented on Dec 17, 2014

    @ljbade
    ContributorAuthor

    @kkaefer awesome

  24. ljbade commented on Jan 27, 2015

    @ljbade
    ContributorAuthor

    @kkaefer So where did this get to? I think Android was done right?

  25. kkaefer commented on Jan 27, 2015

    @kkaefer
    Member

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions