Android Question General question on most efficient code App organization

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi to all
My question is related to how efficiently organize the code of an App. I will give you an example: in Windows, we have the possibility to put the code in various modules (of course), and in static or dynamic libraries. Static libraries are linked to the code, and I guess there is no big difference either in size or performance in the final module. But my question is related to the existence of Dll that may be loaded at runtime (in Windows). In this case the benefit is in terms of size may be notable, while the drawback is the loading time of the dll. Moreover, if the part of code of the dll is never involved during the use of the Program, because it is doing many tasks, which are not necessarily contemporary, we can have also benefit in terms of memory usage.
The App on which I am working is rather big and, besides already fighting with the actual Android limit of about 0.5 Gb, I begin to wonder myself whether I can try something to break the code in modules. Of course I already did it, but i suppose that, in practice, no benefit on having an enormous module or a big set of smaller ones. My question is only related to code, not on organization in pages, because, in practice, i just have two pages and the working one is only the second. For example, I am thinking that maybe putting some code parts, not always called, in services, may do something similar to the Windows Dynamic libraries. Thanks in advance for any comment.
 

LucaMs

Expert
Licensed User
Longtime User
actual Android limit of about 0.5 Gb
From https://developer.android.com/guide/app-bundle

"That is, when a user downloads your app, the total size of the compressed APKs required to install your app (for example, the base APK + configuration APKs) must be no more than 4 GB. Any subsequent downloads, such as downloading a feature module (and its configuration APKs) on demand, must also meet this compressed download size restriction. Asset packs don't contribute to this size limit, but they do have other size restrictions."

When you use the app bundle format to publish your app, you can also optionally take advantage of Play Feature Delivery, which lets you add feature modules to your app project. These modules contain features and resources that are only included with your app based on conditions that you specify, or are available later at runtime for download Using the Play Core Library.
Game developers who publish their apps with app bundles can use Play Asset Delivery: Google Play's solution for delivering large amounts of game assets that offers developers flexible delivery methods and high performance.



I don't know if and how we could use those features "Play Feature Delivery" and "Play Asset Delivery" with B4A (Erel?).


Note, however, that thousands and thousands of lines of code take up very little space.
For your convenience use classes (these are better than code modules) and even better "transform" them into your own B4XLibs.
 
Upvote 0
Top