With Context.createPackageContext, you can use the
CONTEXT_IGNORE_SECURITY flag along with CONTEXT_INCLUDE_CODE to load
the code in the apk. You will then need to do your own security
checks, which is probably making sure that the .apk you are loading is
signed with the same certificate as your own. Yup, you do need to be
careful here to avoid creating security bugs.

Btw, about DexClassLoader, I think that approach is not recommended as
the code you load will not be able to access the resources from its
own apk. However, with Context.createPackageContext, since you are
creating a Context, the code will have access to its resources.

On Mar 10, 10:56 am, Mark Murphy <[email protected]> wrote:
> On Thu, Mar 10, 2011 at 1:42 PM, Shri <[email protected]> wrote:
> > You can use Context.createPackageContext to load the other apk, and
> > then use reflection to load the class. 
> > Seehttp://www-jo.se/f.pfleger/apk-piracy.
>
> I stand corrected.
>
> However, anyone loading code indiscriminately from another package is
> asking for trouble (e.g., malware injection).
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training Worldwide:http://commonsware.com/training

-- 
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