有人在 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);
}
}
现在这应该false
在新的卸载时返回,但在全新安装时调试它我在 App Startup 上得到以下信息。
如果这很重要,我也会运行 Proguard,当在未启用 proguard 的 APK 上运行设备时,它运行正常。在任何其他设备上运行 proguard 运行良好。