Is there a standard way to deal with large assets (>100 MB)?

Happy new year everyone!

I have an ionic-3 app for iOS and Android that requires large assets, in total about 300 MB of mostly images. The app needs to work without cellular or wifi connection, which is why I can’t download the assets on demand.

Unfortunately, Google limits the size of the APK file to 100 MB. Is there a standard way to deal with this situation?

I’ve found the https://github.com/agamemnus/cordova-plugin-xapkreader. Unfortunately, this would only work for Android. Before inventing some kind of iOS/Android switch, I was wondering if somebody knew a better way. Thanks!

I would suggest making this content a post-install requirement. I.e. have it auto download once launched for the first time

1 Like

Thank you, Judgewest2000, for your suggestion.

For others facing the same problem: I will try this using ionic’s live-update mechanism.

  • The assets will be compiled in different compression rates: A low preset is about 90 MB, and a high preset is my original 300 MB.
  • The high preset is used in the iOS app that will be deployed to the Apple-App-Store.
  • The low preset is used in the android app that will be deployed to the Google-Play-Store, meeting Google’s 100-MB limit.
  • The high preset will be pushed to ionic: git push ionic master. This way, after downloading the app from the Google-Play-Store (100 MB), the ionic-live-update mechanism will fetch the larger assets (300 MB) from ionic.

Is this content static like images, videos etc?

I.e not code

Yes, it is static content.

By the way: Does the ionic live update try to update over a cellular connection or only when in wifi?

You can try with ionic live but if it’s static I would still recommend making it a post-install operation using a regular web server.

Then you can have a proper loading screen etc. Ionic pro isn’t really supposed to be used for content like that, neither is git.

1 Like

Hei,
I am in the same situation, where I have 300 MB static files which is required for my application. The only way that I can think of is download files using the ionic file plugin during the initial loading (first time) but in that case, the files which we are downloading(images, video) will be publically available throughout the phone right? Can you please advise on this or if you have another idea pls do let me know.

I guess this depends on exactly what you mean by “publicly”, but if “anybody with physical access to the device in an unlocked state” qualifies, then what you have said is true not just for any specific case, but for any solution to this problem. Anything the app can access, so can the device owner.

What I meant is, the assets downloaded will be available in the data folder (if we are using “dataDirectory” ) which can be accessed via any file explorer. In obb (native apk extension approach), assets cannot be accessed in the above manner,

Is there any alternative approach like obb(native apk extension approach) in ionic ?

Hello, if you are worried undesired access if these files, maybe you can use a simple encryption for your files.
i.e.:

BTW , ionic file transfer plugin is deprecated any other approach to download large files like 200 mb.

Hi!
I think you may process the images using an Api from Tinypng for example to become more tight and use lazy loading inside the App to avoid to crash it. Also use some cache to offline images. But please, put 300 MB inside an App seems me not normal and can be not useful to the users.
The UX will be down.