Consume PHP / SOAP WebService on Android

0

I'm developing an Android application that consumes a PHP webservice through the ksoap2 library.

I'm currently querying the webservice with a class that extends an AsyncTask. But because it does the task in parallel with the Thread UI I'm having problems with the logic of the program.

Can I make requests to the webservice in a normal class that does not extend an AsyncTask?

The problem was that I was comparing the login data of my user object while AsyncTask was still updating this data. This meant that the user could not log in when entering their data. The solution was to make the comparison in the onPostExcute () of AsyncTask, very simple. Thanks for everyone's input and it really is much better to perform heavy tasks on a separate thread.

    
asked by anonymous 22.01.2015 / 18:47

2 answers

0

You should not do this. You must use a separate thread to handle networking. For HTTP requests you can use the OkHttp / Retrofit or Volley libraries if you do not feel comfortable implementing AsyncTask

    
23.01.2015 / 08:00
0

If you execute the request in the Thread UI your application (i.e. common screen) has been locked until the query returns from the server. This is not good practice leaving your application usability below expectations!

I recommend you look at the competition issue of your app instead of starting for the Thread UI. Do not be a believer in "religion" Extreme Go Horse - link

I hope I have helped!

    
22.01.2015 / 19:17