I'm developing one app, with the package com.example1
and I'm doing another module to use as a library with the package com.example2
.
On my module (com.example2
) I'm using this static functions:
public static void saveLastDownload(Activity mActivity, long numberLong) {
SharedPreferences sharedPref = mActivity.getPreferences(Context.MODE_APPEND);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putLong(dataLastDownloadKey, numberLong);
boolean commit = editor.commit();
}
public static long readLastDownload(Activity mActivity, long defaultValue) {
SharedPreferences sharedPref = mActivity.getPreferences(Context.MODE_PRIVATE);
return sharedPref.getLong(dataLastDownloadKey, defaultValue);
}
I'm trying to saveDownload
and readLastDownload
from com.example1
but I haven't got any value on these shared preferences. How can I read this value in a modern way (without any security holes, although I'm not interested in making it private).
How could I do it?
Thank you very much in advance.