简体   繁体   English

在Android应用程序中保存数据?

[英]saving data in android application?

I just started my first android application and in this application I plan to save username and password of the user. 我刚开始我的第一个Android应用程序,在这个应用程序中,我计划保存用户的用户名和密码。 So my question is is it safe to save user name and password in file without decoding it? 所以我的问题是将文件中的用户名和密码保存而不解码是否安全? I mean can anyone acess data the text files in android? 我的意思是任何人都可以访问android中的文本文件吗? Sorry I have developed for iOS before so I am not sure about that. 对不起,我之前为iOS开发过,所以我不确定。

thanks 谢谢

Assuming the device is not rooted, no application can access an other application's data files unless this application shares it using some kind of a Manager. 假设设备没有root,没有应用程序可以访问其他应用程序的数据文件,除非此应用程序使用某种管理器共享它。

Read more about it here: http://developer.android.com/guide/topics/security/security.html 在此处阅读更多相关信息: http//developer.android.com/guide/topics/security/security.html

You should take a look at the different types of Data Storage provided to you by the Android framework. 您应该看一下Android框架提供给您的不同类型的数据存储

It's probably a little overkill to go ahead and create a database, if you're only going to store username and password - but if you're going to store more than that in a database later on, you might aswell use the database for username and password too. 如果你只想存储用户名和密码,那么继续创建一个数据库可能有点过头了 - 但是如果你以后要在数据库中存储更多,那么你也可以使用数据库作为用户名。和密码。

If it's only username and password, I'd go for using the Shared Preferences . 如果它只是用户名和密码,我会去使用共享首选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM