I’m building an Android app to provide the functionality of a website on android phones.
People are required to login, and they remain logged in using cookies, allowing them to do things under their own account. All the code for logging in/authentication has been done for the website, and I’m now writing an Android app to do the same thing.
My question is, if the Android app sends a HTTP request to the PHP server, and the server in return sets some cookies (to show that the user has logged on), would these cookies remain set on the Android app during all future HTTP requests to the server?
Or, do I need to work out a new authentication scheme for android, e.g passing a special token to the app on user login, and the app providing this token during all future requests to authenticate the user?
You should use the CookieManager and CookieStore To save Cookies.
You would use this with the HttpURLConnection Class.