作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何在 Android 应用程序中保护数据免受黑客攻击?我需要使用一些 secret key (因为应用程序将通过 Web 服务运行)所以我需要知道建议在哪里保存这些 secret 信息以及如何保存?
最佳答案
您可以使用未存储在可访问文件/文件夹中的 SharedPreferences
。点击here有关 SharedPreferences 和 here 的信息了解如何使用它。这是一个例子:
// Get settings
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
// Get editor to be able to put settings
SharedPreferences.Editor editor = settings.edit()
// Put information with specified key
editor.putString("example_key", "example value");
// Commit changes
editor.commit();
// Gets value from setting with the specified key
String exampleString = settings.getString("example_key", null);
关于java - 如何在 Android 中保护信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6880342/
我是一名优秀的程序员,十分优秀!