CopyPastor

Detecting plagiarism made easy.

Score: 0.8275122520606369; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2016-01-21
by Muhammad Younas

Original Post

Original - Posted on 2012-03-07
by Graham Smith



            
Present in both answers; Present only in the new answer; Present only in the old answer;

There are many factors surrounding speed, such as the connectivity (wifi/3g/4g/hsdpa), or server response times. or if the user is paranoid and has constructed a Faraday cage. These are just a few possibilities. You just need to do the best you can, via performance enhancements and error handling (however I would get something working to avoid early optimisation issues).
You could look at simple things like using JSON over XML as it has a smaller size or even use compression.
There are many factors surrounding speed, such as the connectivity (wifi/3g/4g/hsdpa), or server response times. or if the user is paranoid and has constructed a Faraday cage. These are just a few possibilities. You just need to do the best you can, via performance enhancements and error handling (however I would get something working to avoid early optimisation issues).
You could look at simple things like using JSON over XML as it has a smaller size or even use compression.
I would argue, although I have never done it, you could use UDP but it depends if you 100% need your packets of data to arrive. As far as I understand, TCP tried to ensure packet delivery however because of this it is slower. For example if this is some sort of FPS I would use UDP however if it is turn based then TCP would be fine.
An example tutorial for UDP can be found here: http://www.helloandroid.com/tutorials/simple-udp-communication-example
If you want to poll make sure to do so asynchronously as you don't want this to happen in the main thread. You *could* use the AlarmManager as there is no need for a service although as you said "no need to poll when the user isn't playing" you could implement your own setup
To help here are links to some Alarm and AsyncTask tutorials:
- http://developer.android.com/resources/articles/painless-threading.html [really good article about the AsyncTask class and how to use it by Google] - http://www.vogella.de/articles/AndroidPerformance/article.html [AsyncTask tutorial] - http://www.vogella.de/articles/AndroidServices/article.html [AlarmManager] - http://developer.android.com/reference/android/app/AlarmManager.html [class definition from Google]


        
Present in both answers; Present only in the new answer; Present only in the old answer;