簡體   English   中英

startActivity並攔截其他意圖

[英]startActivity and intercept intent extras

我正在考慮為登錄用戶執行以下操作:

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

這樣安全嗎,還是其他應用可以輕松聽/讀意圖參數?

您當前的方法是安全的,沒有其他應用程序可以監聽或讀取這些值。

您正在使用Explicit intent [you actually specify the activity that is required to respond to the intent]並且僅由Intent中聲明的類偵聽。 所以這是安全的。

對於您的信息,您可以通過意圖傳遞對象,這將在傳遞一堆值的情況下提供幫助。 鏈接

為了增強安全性,應該將密碼存儲在char數組(char [])中,然后在使用后通過清除數組來清除密碼,如下所示:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM