Unpack/Repack android application inside another application

316 views Asked by At

I have an application that use resource inside second application, and by some condition the resources inside second application should be changed, and now I want to unpack the second .apk file inside my main application and change its resource, then repack it and finally install it.

All two applications is mine and created with eClipse LUNA.

How can I do this inside the device?

1

There are 1 answers

0
Mostafa Gazar On

You cannot, I mean if they are two separate applications, because each application runs in its own process.

That said you can use android:sharedUserId in your manifest.xml, both apps should e signed with the same certificate

The name of a Linux user ID that will be shared with other applications. By default, Android assigns each application its own unique user ID. However, if this attribute is set to the same value for two or more applications, they will all share the same ID — provided that they are also signed by the same certificate. Application with the same user ID can access each other's data and, if desired, run in the same process.

It will be something like the following

App 1

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.meg7.app1"
    android:sharedUserId="com.meg7.shared">

App 2

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.meg7.app2"
        android:sharedUserId="com.meg7.shared">

And use the following in app1

Context app2Context = this.createPackageContext( "com.meg7.app2", Context.CONTEXT_IGNORE_SECURITY);// CONTEXT_INCLUDE_CODE
app2Context.getResources().getDrawable(resId);

What do you mean by

resources inside second application should be changed