Session keeping method under volley framework in Android

The manager of the company pulled me out to become a living horse doctor and an android app. As Xiaobai, who has just graduated for a few months and has only trained for a few months, this is undoubtedly a great challenge. Of course, the biggest challenge is not this. The biggest challenge is to do it in two weeks. This is the most painful. To be honest, for people with two or three years of development experience, it is very simple to develop a project in two weeks. Maybe there is still a lot of time to do other things.

So I was baffled as soon as I came up. It was still easy to log in. As long as I verified the returned information, I could jump. However, when I connected the data interface later, I reported various errors. After two days, I checked a lot of information and accepted the ridicule and abuse of the old people of the company, and finally made it.

This is a session based network session. When the mobile app sends a login request to the server, the head of the network response (network response) returned by the server stores the session ID you want. At this time, just rewrite parsenetworkresponse:

Step 1: add this method after errorlitener to obtain sessionid

The above is written on the page at the time of initial login.

Step 2:

Step 3: send the session when sending the data request

The listener and errorlistener in this can be extended. It's OK to write them outside, and it's OK to write them in this way

The above is the method of maintaining conversation under the volley framework in Android introduced by Xiaobian. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>