Best option to store username and password in android app

前端 未结 10 1890
深忆病人
深忆病人 2020-12-13 06:26

I am developing an Android app where the user needs to sign in to perform operations. But mostly on an android handset, people use \"Keep me signed in\", In

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 06:37

    The safest way to do this without jeopardizing security is to use the shared preferences to store ONLY the username of the last person to login in.

    Also, in your table of users, introduce a column that holds numeric boolean (1 or 0) to represent whether the person checked the person checked the "remember me" checkbox or not.

    When launching your app get the username using the getSharedPreferences() function and use it to query your hosted database to see whether the signedin column is either 1 or 0 , where 1 indicates the person checked the "remember me" checkbox.

提交回复
热议问题