And*_*oid 39 android sharedpreferences nexus-6p
有没有人在Nexus 6P设备上遇到过这个问题?我只是在Nexus 6P(运行Google Fi)上遇到此问题.
当我安装的应用程序有一个关键的userIsLoggedIn内部SharedPreferences.
这个块:
boolean userIsLoggedIn = SharedPrefs.userIsLoggedIn(this);
// Then in another class...
public static boolean userIsLoggedIn(Context context) {
// For users updating apps, if the previous key-value is a string, convert it to boolean
try {
return context.getSharedPreferences(LOGIN_FILE, Context.MODE_PRIVATE)
.getBoolean(USER_LOGGED_IN, false);
} catch (ClassCastException e) {
Logger.e(TAG, e.getMessage());
context.getSharedPreferences(LOGIN, Context.MODE_PRIVATE)
.edit()
.putBoolean(USER_LOGGED_IN, false)
.commit();
return context.getSharedPreferences(LOGIN, Context.MODE_PRIVATE)
.getBoolean(USER_LOGGED_IN, false);
}
}
Run Code Online (Sandbox Code Playgroud)
现在这应该返回false一个新的卸载,但在全新安装上调试它我在App Startup上得到以下内容.
我也运行Proguard,如果这很重要,当在非proguard启用的APK上运行设备时它运行正常.在任何其他设备上运行proguard运行正常.
cod*_*2be 77
由于Nexus 6P运行Android M,我认为自动备份是个问题.
我想你可以使用allowBackup来阻止它.
请检查此答案:https://stackoverflow.com/a/32010582/336312
Ash*_*kol 11
在Android M及以上版本中,他们将应用程序备份保留在谷歌驱动程序中,你可以通过使用来禁用它,转到应用程序部分设置为false 下的项目清单文件.你很高兴.android:allowBackup="true"
| 归档时间: |
|
| 查看次数: |
14234 次 |
| 最近记录: |