I have a free game and I'm making a paid version. The free game stores an integer high score in the general preferences file that I created in MODE_WORLD_READABLE mode. The paid version must copy this account if the free version is installed.
The code I use 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 application if it exists (otherwise you get an exception). The second line gets the file of general preferences. Then I can use prefs.getInt to get a high score.
Problem: this works fine in Android 1.5, 2.1, 2.3, etc., but it does not work for me in Android 3.0 or 3.1 emulator. The code above is executed, but getInt always returns the default value.
This is mistake? Honeycomb Feature? Are there any rights to the application that I donβt know about? How can I diagnose this further?
rbbcc source share