I have a free game and I'm making a paid version. The free game stores an 
integer high score in a shared preference file I created in 
MODE_WORLD_READABLE mode. The paid version needs to copy this score over if 
the free version is installed.

The code I'm using for this is as follows:

Context c = paidContext.createPackageContext("my.app.packagename", 
Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences prefs = c.getSharedPreferences(SHARED_PREF_FILENAME, 
Context.MODE_WORLD_READABLE);

The first line creates the context for the free app if it exists (you get an 
exception otherwise). The second line gets the shared preferences file. I 
can then use prefs.getInt to get the high score.

The problem: This works just fine in Android 1.5, 2.1, 2.3 etc. but it isn't 
working for me in the Android 3.0 or 3.1 emulator. The code above runs but 
getInt always returns the default value.

Is this a bug? A feature of Honeycomb? Are there some app permissions I 
don't know about? How can I diagnose this further?

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