最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to Create an Android Host App That Loads UI Plugins from External APKs? - Stack Overflow

programmeradmin3浏览0评论

I am android devloper I like creating ui i want to showcase my ui in way that i won't have to update app every time i make new ui. I was think thinking of making one host app and every time i make new ui, i will release it as plugin apk that i will be able to see in my host apk then i can download load it and view it

i don't want to cretate saprate apk that user has to open to see that specific ui , it should show only in my app and user can install and uninstall like plugin

if anyone have any idea or example i will be very grateful if you tell me

(i will use github to distribute apk and plugin apk)

i haven't tried any thing as i don't know where to start (and i fot to mention i am working in jetpack compose )

I am android devloper I like creating ui i want to showcase my ui in way that i won't have to update app every time i make new ui. I was think thinking of making one host app and every time i make new ui, i will release it as plugin apk that i will be able to see in my host apk then i can download load it and view it

i don't want to cretate saprate apk that user has to open to see that specific ui , it should show only in my app and user can install and uninstall like plugin

if anyone have any idea or example i will be very grateful if you tell me

(i will use github to distribute apk and plugin apk)

i haven't tried any thing as i don't know where to start (and i fot to mention i am working in jetpack compose )

Share Improve this question asked Feb 15 at 4:32 Akshar KalathiyaAkshar Kalathiya 253 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

There is a feature called Activity embedding.
To load ui from external app, use Cross-application embedding.

You can implement that mentioned plugin startegy, using ClassLoaders (typically a DexClassLoader), but there are a lot of catches. Dynamically loading code can open security risks. You would have to make sure you trust the source of your plugins and consider sandboxing or verifying the APK’s integrity, loading and offloading the resources, handle challenging permissions needed to do so, aaand so on...

So that's a long and painful way.


BUT

Considering your needs, there are some actual ACHIEVABLE approaches.

  1. To define the entire view set you would need and recognize your views via flags. (but still not dynamic)

  2. Try to define them using "Resources" and "Assets" files. (Recommended) Try to make your views dynamic by extracting everything you can in Resources, then, by whatever policy you wish, you can replace (or append) the resources file by another one which you fetch from a remote server.

  3. Using WebViews like Iframes and show different segments, and whenever you decide to change the appearance, (since it is a web content) you just change the web frontend.

Hope that meet your needs,

发布评论

评论列表(0)

  1. 暂无评论