Monday, May 13, 2013

[android-developers] Re: Sharing SharedPreferences from two different processes

Context.MODE_MULTI_PROCESS

That is only available in API 11+ (3.0 and later)

On Monday, May 13, 2013 7:29:37 PM UTC-4, Gary Blakely wrote:
My app originally had an activity and a service running in the same process. When I first wrote it I specified sharedPreferences with MODE_PRIVATE. The app has grown, and for reasons beyond the scope of this post, I now need to run my service in a different process.

I found I can do this by specifying a name starting with a colon in the android:process statement in my manifest file.

However now my activity and my service are no longer reading the same sharedPreferences. Researching this problem I see many reccommendations to use MODE_MULTI_PROCESS. But I cannot figure out how to spedify it.

SharedPreferences myMemory = getSharedPreferences("myMemory", MODE_MULTI_PROCESS);

This does not work because Eclipse can't find MODE_MULTI_PROCESS like it can find MODE_PRIVATE or MODE_WORLD_READABLE.  I don't know where the ENUM for MODE_MULTI_PROCESS is.

So, how can I specify MODE_MULTI_PROCESS ??
thanks, Gary

--
--
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
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate