You can't do that.

If you want 2 separate apps (i.e. apps with a different package name and 
therefore different user-ids) to share data, you'd have to device other 
measures:

   1. Write your own ContentProvider that is public/exported.
   
   http://developer.android.com/guide/topics/providers/content-providers.html 
   Both apps can read and write from this and exchange info this way.
   You can implement this ContentProvider in a Project Library used by both 
   your apps.
   
   2. If one app is always sending and the other is always receiving, write 
   your own public/exported Service or a BroadcastReceiver for the receiving 
   app. The sending app can invoke these by sending an Intent 
   (startService/bind or sendBroadcast)
   For extra security, I'd suggest using a BroadcastReceiver using your own 
   homegrown permission.
   
   3. Have the receiving app setup a simple 'Web' Server (listening 
   sockets). 
   Have the other app send data to this socket. 


On Tuesday, November 27, 2012 2:56:27 AM UTC-5, 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to