> On May 30, 7:09 pm, Nikolay Elenkov <nikolay.elen...@gmail.com> wrote:
>> On Tue, May 31, 2011 at 10:54 AM, String <sterling.ud...@googlemail.com> wrote:
>> > In any case, I would agree that expecting them to synchronize between
>> > processes in real time is, um, unrealistic, but they definitely do work for
>> > the simple case of one app being able to read the prefs which another has
>> > written. Both apps need the same signature, AFAIK, and you need to be
>> > careful with permissions, but I've done this a few times now.
>>
>> Don't you need to set the same sharedUserId in both apps for this to work?
>> (unless prefs are WORLD_READABLE). If the first app is already published
>> without a sharedUserId, will adding it in a next version break things? AFAIK, ,
>> adding sharedUserId changes the app's UID.
>
> Nope, both apps just need to be signed with the same cert. They will
> both be installed with the same underlying linux user id. What you're
> talking about is what's required when you need two apps to run in the
> same linux process.
>
Hm, I'm definitely getting different UIDs for apps signed with the same key:
ls -l /data/data/org.appA/shared_prefs
-rw-rw---- 1 app_2 app_2 469 May 31 03:30
org.appA_preferences.xml
# ls -l /data/data/org.appB/shared_prefs
-rw-rw---- 1 app_87 app_87 933 May 30 00:48
org.nick.appB_preferences.xml
Which is consistent with the docs (nothing about signatures):
* 'At install time, Android gives each package a distinct Linux user ID'
* 'Any data stored by an application will be assigned that application's
user ID, and not normally accessible to other packages.'
It does say that in order to use sharedUserId you need to sign with the
same key:
'Note that in order to retain security, only two applications signed
with the same signature (and requesting the same sharedUserId)
will be given the same user ID.'
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment