开发者

How to create an android plugin with views, activities and objects

开发者 https://www.devze.com 2023-02-27 10:37 出处:网络
So... I\'m trying to create a plugin for one of my apps. This plugin would require several views, images, an activity and a parser for CharSequences... Ideally, this plugin would be downloadable from

So... I'm trying to create a plugin for one of my apps. This plugin would require several views, images, an activity and a parser for CharSequences... Ideally, this plugin would be downloadable from the Android Market.

I understa开发者_运维问答nd how to create a library, but that would need to be included in the application.

I understand how to create an app as a service and just call it via intents, but I need direct access to objects and code that is neither parceable nor serializable.

What I have been looking at is eyes-free TTS. With their implementation, the developer includes a small TTS_library_stub.jar file in their app, which looks like it defines a lot of the necessary classes/objects.

So my question is, how would I go about building something like this and generating this "stub" .jar file, which would be included in my app? I've been trying to work my way through the TTS code, but it's a massive codebase, and I'm having trouble finding what I'm looking for.

Any help would be massively appreciated :)


The service and the app need to have the same sharedUserId in the manifest and be signed with the same key. Then the app and service can share eachothers assests, classloader and even run on the same thread. I have never included part of the GUI in a service, so maybe that is a limitation...not sure.

If there is a limitation, you must be able to work around it. Look at OpenIntents. It is open source, it is a service and you can download that from the Market. It provides a GUI file browser to any app that uses its intents.

Didn't full understand what you needed, but thought this might help.


If you want android library to be downloaded from market, It has to be standalone android application. (not android library project!). Then you can upload it to market, download it to phone and communicate with it via intent(which this library can handle) or service(aidl) or provider(the data from library) and perhaps receiver, but I never used it in that way.


If you would design your app for an OSGi environment like apache felix it might be possible to load libraries at runtime.
In their presentation they described how the whole concept is working. Since only APKs can be shared in the android market you would need to write your own "update mechanism" which downloads your OSGi bundles (your plugins) and deploys them to felix.

0

精彩评论

暂无评论...
验证码 换一张
取 消