A good way to do this is publish it as a service in another .apk, which you
can query the package manager for and bind to.  This isn't really a true
plug-in though (a service is a global singleton in the system, and you'll
nee to define a .aidl interface to it so it can run in another process).

Another approach is to put your plug-in into another .apk, publish it in the
manifest however you want, find the .apk with the Package Manager, and then
use Context.createApplicationContext() with the flag to load the code.  From
there you can get the ClassLoader for the other .apk and instantiate
classes.

If you do the latter though you really need to be aware of what you are
doing: this has all kinds of security implications for you, can have
problems if code ends up running as different uids, etc.  This is best for
the situation where you provide all of the plug-ins, so you can sign them
with the same certificate and use a shared user ID for all of them as well
as the main application.

On Fri, Nov 28, 2008 at 2:39 AM, Xiaoliang Ding <[EMAIL PROTECTED]> wrote:

>  Hi, Ludwing, Louis
>
>     But how about a new added application. If we want to a new
> plug-in added into the main application, how can do it ?
>
> Thanks
> Ding
>
>
> 2008/11/28, Louis <[EMAIL PROTECTED]>:
>
>>
>> Thanks Ludwig. And by the way, could we download a Jar file and put it
>> into the basic application, then the basic application can call it
>> through some interfaces?
>>
>> On Nov 27, 8:28 pm, Ludwig <[EMAIL PROTECTED]> wrote:
>> > Think about Intents and split your application into multiple
>> applications
>> > (perhaps running under the same userid), each serving a bunch of
>> intents.
>> > Then you can upgrade each application (which might just respond to one
>> > intent) separately and Android will at run-time find the best-matching
>> > intent (or give the user the choice which one to use if there are
>> multiple
>> > good matches).
>> >
>> > Ludwig
>> >
>> > 2008/11/26 Louis <[EMAIL PROTECTED]>
>> >
>> >
>> >
>> > > Hi, All:
>> >
>> > > Our products which running in other platform are using the modular
>> > > approach, which means if user want to add a new feature, he/she only
>> > > need to download a new plug-in, but not reinstall the who application.
>> > > And we used COM library base ideas to do that before, is there anyway
>> > > to do it in Android?
>> >
>> > > Welcome any help for it.
>> >
>> > > Best regards,
>> > > Louis. >>
>>


-- 
Dianne Hackborn
Android framework engineer
[EMAIL PROTECTED]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to