Reputation: 299
I have two projects/packages part of the same application. The main project of the application does virtually everything on the app. However, we used a 2nd project to manage updates to the application. We are using shared preferences that are updated from the sqlite3 database and applied in the main application using
editor.putString("string", sString).apply();
We also use the following logic to see if its a new version and if so restart the autoupdate package
if (!sCurrentVersion.equals(ver)) {
Intent intent1 = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
intent1 = manager.getLaunchIntentForPackage("com.pack.autoupdate");
intent1.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(intent1);
}
Then in the autoupdate package, we simply just use getSharedPreferences(). The values we need in the shared preferences are the update urls that the autoupdate package needs to check.
Our problem is that we updated those urls in the database, however we are still getting some devices that are using the old urls in the autoupdate check. Do I need to make sure and restart autoupdate or is there something i'm doing wrong with sharedpreferences?
Upvotes: 1
Views: 7468
Reputation:
Did you do call the .commit() method to update your SharedPreference value?
Update :
More information regarding the difference between .commit() and .apply() Here
Upvotes: 2