You could try using android:process with the same process name on the 
manifest declaration of the activities in each app between which you wish 
communication to occur.  Note that they will also probably have to share a 
single heap, which may create problems, depending upon how much memory is 
consumed by the apps' activities collectively.  

The purpose of android:process on an activity is to specify that your 
activity should be launched in a process having a specific name. The choice 
of that name may be used either to isolate the activity in its own process 
(other than the one the launched it), or to force it to cohabit in a single 
process with other activities (potentially from different apps) that use 
the same name.

Per the Dev Guide 
(http://developer.android.com/guide/topics/manifest/activity-element.html):

"If the name assigned to this attribute begins with a colon (':'), a new 
process, private to the application, is created when it's needed and the 
activity runs in that process. If the process name begins with a lowercase 
character, the activity will run in a global process of that name, provided 
that it has permission to do so. This allows components in different 
applications to share a process, reducing resource usage."
Both apps also have to be signed by the same certificate.

Per http://developer.android.com/tools/publishing/app-signing.html:

"Application modularity – The Android system allows applications that are 
signed by the same certificate to run in the same process, if the 
applications so requests, so that the system treats them as a single 
application. In this way you can deploy your application in modules, and 
users can update each of the modules independently if needed.

"Code/data sharing through permissions – The Android system provides 
signature-based permissions enforcement, so that an application can expose 
functionality to another application that is signed with a specified 
certificate. By signing multiple applications with the same certificate and 
using signature-based permissions checks, your applications can share code 
and data in a secure manner."

Caveat: While I have successfully used android:process to provide a 
separate heap to a help activity within an app, I have not yet tried to use 
it to communicate between two separate apps.

On Monday, November 26, 2012 11:56:27 PM UTC-8, Android Test wrote:
>
> Hi All,
>
> I have 2 applications with different package names. E.g. App1 and App2.
>
> App1 needs to write some files to App2's internal memory so that it could 
> be uploaded to the backend.
>
> I have used the following in App1 to do so:
>
> filePath = getPackageManager().getPackageInfo("app2.package.name", 
> 0).applicationInfo.dataDir;
>
> I can get the correct path but could not write to it. I checked the 
> logcat, it is showing "Permission denied".
>
> Am I missing something? What's else needs to be done?
>
> Thanks in Advance
>

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