Skip to content Skip to sidebar Skip to footer

How Do I Fix The Password/ Username Authentication In My Code?

I have an app in which I log in using my username and password and then I switch to a page which contains a webview. The webview recognizes this username and password and loads the

Solution 1:

Ok.

you have to add the username/password in the onResume instead of OnCreate

like explain in this Document http://developer.android.com/reference/android/app/Activity.html


Solution 2:

Move the SharedPref code into onClick and report here...


Solution 3:

This is the problem of cookie management.

CASE :~ 1 IF you are visiting other web site (facebook,gmail,etc.) To solve this you have to maintain cookie files which was coming through vebView.

& send back it to next time new page request.

CASE :~ 2 if you are visiting your own web site then there is one another problem solution is you can check on server side (in your web site) device info & compare it to that device info which was at login time.

or you can send hidden data in hidden tag & validate it in your app.


Solution 4:

In my previous project, I have faces some similar problem. I solve there in this approach - instanciate the blank/default layout in onCreate, then load the configuration from sharedPref and set the parameter value for the layout inside onResume. and before leaving the page save the configure changes(if happens) inside onPause. If this looks good to you can check it in your case.


Post a Comment for "How Do I Fix The Password/ Username Authentication In My Code?"