Android应用程序第一次运行 [英] Android Application first run

查看:116
本文介绍了Android应用程序第一次运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我存储敏感的用户数据(如银行详细信息),用户可以通过使用一个单独的密码锁的每个细节。我希望用户尽快设置一个主密码,他的运行应用程序在第一次安装之后,这样他可以通过输入的情况下,他忘记了密码,该主密码恢复数据。

In my application, I store sensitive user data (like bank details) and the user can lock each of the details by using a separate password. I want the user to set a master password as soon as he runs the application for the first time after installation, so that he may recover data by entering this master password in case he forgets a password.

所以,当应用程序运行在第一次安装之后,将有一个弹出窗口,询问他设置主密码和用户需求来设置密码,以进一步继续。

So, when the application is run for the first time after installation, there would be a pop-up asking him to set the master password and the user needs to set the password to continue further.

不过,当应用程序后,将手机重启或关闭应用程序后,也许开始,他不应该得到弹出。

But, when the application would be started after a phone restart or maybe after closing the application, he should not get the pop-up.

在应用程序运行在第一次安装后的弹出应该来一次,并且只有一次。

The pop-up should come once and only once when the application is run for the first time after installation.

假设 setMasterPassword()是创建对话框,在这里我呼吁第一次运行这个功能吗?功能

Assuming setMasterPassword() is the function which creates the dialog, where do I call this function on first run ?

是否的android具有任何参数,以确定该应用程序已经被新安装?

Does android have any parameters to determine that the app has been newly installed ?

或者我应该只使用 preference变量以检查这个? {某物喜欢初始化在preferenceVariable为0的计数器,然后检查在的onCreate此值()和调用setMasterPassword()当且仅当计数器为0,然后递增1,以便计数器,它将不会被调用再次}

Or should I just use Preference Variables to check this ? {Something like initializing the counter in the PreferenceVariable as 0 and then checking this value in onCreate() and calling setMasterPassword() if and only if the counter is 0 and then incrementing the counter by 1 so that it would never be called again.}

什么是做到这一点的最好方法是什么?

What would be the best way to do this ?

在此先感谢!

推荐答案

我也试图找出是否有一个全新安装布尔,但似乎没有什么比这一点,所以你应该去共享preference,像民间也这里

I have also tried to figure out if there is a "fresh install" boolean, but it seems there is nothing like that, so you should go for a shared preference, like the folk did here.

PS:顺便说一句,它是这个问题重复

PS: By the way, it's a duplicate of that question.

PS2:请记住,如果用户删除应用程序的所有存储的信息,检查也将被删除,因此你就可以再次进入这个

PS2: Keep in mind, if the user deletes all the stored information of your application, the check will also be erased and thus you'll be able to enter this again.

如何提高你的信息安全:

  1. 连同一些控制字节存储用户的信息(一个随机数,一个特定的字符串,等等),并与用户密码进行加密此。
  2. 在任何时候你需要的用户信息,获取该文件,尝试其内容与用户的密码进行解密(要求每个时间)
  3. 检查控制字节( SUBSTR()就足够了,可能)。如果它们是相同的,然后获取信息。如果他们没有,再次提示。
  1. Store the user's information along with some control bytes (a random number, a specific string, whatever) and encrypt this with the user's password.
  2. Anytime you need the user's information, grab that file, try to decrypt its content with the user's password (asked each time)
  3. Check for the control bytes (a substr() will suffice, probably). If they're the same, then grab the information. If they're not, prompt again.

这样一来,你会得到一些好处:

This way, you get some benefits:

  • 您没有任何地方存储用户的密码。共享preferences不会储存这一点,只是firstTime变量。
  • 如果用户转储程序的信息,将再次输入密码不会减少您的信息。
  • 在打开该文件从浏览器将只显示一串数字,符号,可能无法读取字节将主要突破编辑器。

这篇关于Android应用程序第一次运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆