简体   繁体   中英

startActivity and intercept intent extras

I'm considering to do the following for log in a user:

Intent intent= new Intent(this,DoLoginActivity.class);
intent.putExtra("login",mLogin);
intent.putExtra("password",mPassword);
startActivity(intent);

Is that secure, or other apps can easily listen/read the intent parameters?

Your current approach is secure, no other app can listen or read these values.

You are using Explicit intent [you actually specify the activity that is required to respond to the intent] and that is listen by only that class which is declared in Intent. So this is Secure.

For your information you can pass object through intent, this will help in the scenario of passing bunch of values. Link

为了增强安全性,应该将密码存储在char数组(char [])中,然后在使用后通过清除数组来清除密码,如下所示:

Arrays.fill(password, (char) 0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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