Re: [android-developers] Re: Write to another application's internal memory

2012-12-04 Thread Android Test
Ok noted. Thanks for the info.


On Mon, Dec 3, 2012 at 6:15 PM, Amey Bapat amey.n.ba...@gmail.com wrote:

 Hi ,
 There are few bugs related to sharedUserId which you must take into
 account before using it mate.
 read more here:
 http://java-hamster.blogspot.in/2010/05/androids-shareduserid.html




 On Mon, Dec 3, 2012 at 2:23 PM, Android Test aandroidt...@gmail.comwrote:

 Hi All,

 Thanks for all the advice. I used android:sharedUserId in the android
 manifest and now is able to write across the app's internal memory.

 As my only purpose is to write text files (no sharing etc is involved), I
 found this the most easiest to implement.

 On Thu, Nov 29, 2012 at 5:37 PM, skink psk...@gmail.com wrote:

 android:sharedUserId


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




 --
 live and let LIVE!!!

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


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

Re: [android-developers] Re: Write to another application's internal memory

2012-12-03 Thread Android Test
Hi All,

Thanks for all the advice. I used android:sharedUserId in the android
manifest and now is able to write across the app's internal memory.

As my only purpose is to write text files (no sharing etc is involved), I
found this the most easiest to implement.

On Thu, Nov 29, 2012 at 5:37 PM, skink psk...@gmail.com wrote:

 android:sharedUserId

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

Re: [android-developers] Re: Write to another application's internal memory

2012-12-03 Thread Amey Bapat
Hi ,
There are few bugs related to sharedUserId which you must take into account
before using it mate.
read more here:
http://java-hamster.blogspot.in/2010/05/androids-shareduserid.html




On Mon, Dec 3, 2012 at 2:23 PM, Android Test aandroidt...@gmail.com wrote:

 Hi All,

 Thanks for all the advice. I used android:sharedUserId in the android
 manifest and now is able to write across the app's internal memory.

 As my only purpose is to write text files (no sharing etc is involved), I
 found this the most easiest to implement.

 On Thu, Nov 29, 2012 at 5:37 PM, skink psk...@gmail.com wrote:

 android:sharedUserId


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




-- 
live and let LIVE!!!

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

[android-developers] Re: Write to another application's internal memory

2012-11-29 Thread Carl


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

[android-developers] Re: Write to another application's internal memory

2012-11-29 Thread skink


Carl wrote:
 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.


what about android:sharedUserId?

in this case you have two apps running  in two separate VM but having
the same user id which means they have the same file access privs

pskink

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


[android-developers] Re: Write to another application's internal memory

2012-11-28 Thread Streets Of Boston
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

Re: [android-developers] Re: Write to another application's internal memory

2012-11-28 Thread bob
 

Why not just write it to the SD card temporarily?  And encrypt it?



On Tuesday, November 27, 2012 7:57:58 PM UTC-6, Android Test wrote:

 Hi Bob,

 Because, I don't want it to be visible to users. At the same time do no 
 want other unauthorized applications to be able to access the info.


 On Wed, Nov 28, 2012 at 12:04 AM, bob b...@coolfone.comze.comjavascript:
  wrote:

 Why not just write it to the SD card?



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




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

[android-developers] Re: Write to another application's internal memory

2012-11-28 Thread G. Blake Meike


 I think that the fact that this question is about writing to internal 
 memory is confusing people.  I think that all you want to do is allow App2 
 access to a file owned by App1.  That is probably pretty easy:

 App1 will own the file(s).  They will be in its sandbox files directory 
 and not visible to any other app including App2.  App1 must contain a 
 ContentProvider that supports  
 android:grantUriPermissionshttp://developer.android.com/guide/topics/manifest/provider-element.html#gprmsn
 .  When App1 wants to pass a file to App2 it will fire an intent to a 
 service in App2, with a URI that identifies, to its own (App1's) content 
 provider, the file it wants to share.  A Service in App2 catches the intent 
 and makes a request for an {In, Out}putStream, for the URI, to the content 
 provider in App1.  App1's ContentProvider.openFIle method decodes the URI 
 and opens and returns a ParcelFileDescriptor for the file to which it 
 corresponds. (fyi, don't try this with assets!).

 Bob's your uncle.

 -blake
 The 2nd Edition of Programming Android is now available!:
 http://shop.oreilly.com/product/0636920023005.do


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

[android-developers] Re: Write to another application's internal memory

2012-11-28 Thread bob
 

I am not his uncle.

On Wednesday, November 28, 2012 12:39:08 PM UTC-6, G. Blake Meike wrote:

 I think that the fact that this question is about writing to internal 
 memory is confusing people.  I think that all you want to do is allow App2 
 access to a file owned by App1.  That is probably pretty easy:

 App1 will own the file(s).  They will be in its sandbox files directory 
 and not visible to any other app including App2.  App1 must contain a 
 ContentProvider that supports  
 android:grantUriPermissionshttp://developer.android.com/guide/topics/manifest/provider-element.html#gprmsn
 .  When App1 wants to pass a file to App2 it will fire an intent to a 
 service in App2, with a URI that identifies, to its own (App1's) content 
 provider, the file it wants to share.  A Service in App2 catches the intent 
 and makes a request for an {In, Out}putStream, for the URI, to the content 
 provider in App1.  App1's ContentProvider.openFIle method decodes the URI 
 and opens and returns a ParcelFileDescriptor for the file to which it 
 corresponds. (fyi, don't try this with assets!).

 Bob's your uncle.

 -blake
 The 2nd Edition of Programming Android is now available!:
 http://shop.oreilly.com/product/0636920023005.do



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

[android-developers] Re: Write to another application's internal memory

2012-11-28 Thread G. Blake Meike
 
http://en.wikipedia.org/wiki/Bob's_your_uncle

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

Re: [android-developers] Re: Write to another application's internal memory

2012-11-28 Thread Kristopher Micinski
This is the right advice, and this is the Android way to do it.



On Wed, Nov 28, 2012 at 9:45 AM, Streets Of Boston
flyingdutc...@gmail.comwrote:

 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 
 http://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


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

[android-developers] Re: Write to another application's internal memory

2012-11-27 Thread skink


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

google for sharedUserId

pskink

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


[android-developers] Re: Write to another application's internal memory

2012-11-27 Thread bob
 

Why not just write it to the SD card?



On Tuesday, November 27, 2012 1:56:27 AM UTC-6, 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

Re: [android-developers] Re: Write to another application's internal memory

2012-11-27 Thread Android Test
Hi Bob,

Because, I don't want it to be visible to users. At the same time do no
want other unauthorized applications to be able to access the info.


On Wed, Nov 28, 2012 at 12:04 AM, bob b...@coolfone.comze.com wrote:

 Why not just write it to the SD card?



 On Tuesday, November 27, 2012 1:56:27 AM UTC-6, 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 
 http://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


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

Re: [android-developers] Re: Write to another application's internal memory

2012-11-27 Thread Mário César Mancinelli de Araújo
Maybe a good solution would be creating a lib project to take care of that
data and import it in bouth projects.

Then, in this lib project you culd use a database, shared preferences or
anything you want to hold the data. ;-)

Best regards.
Em 28/11/2012 00:03, Android Test aandroidt...@gmail.com escreveu:

 Hi Bob,

 Because, I don't want it to be visible to users. At the same time do no
 want other unauthorized applications to be able to access the info.


 On Wed, Nov 28, 2012 at 12:04 AM, bob b...@coolfone.comze.com wrote:

 Why not just write it to the SD card?



 On Tuesday, November 27, 2012 1:56:27 AM UTC-6, 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 
 http://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


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

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