april wrote: > I am doing a game, which needs to update server player's status. In my > code , I first put those information into database. Then I used a > service to read the information from DB and send to server. > > Following are the document for sevice: > Note that services, like other application objects, run in the main > thread of their hosting process. This means that, if your service is > going to do any CPU intensive (such as MP3 playback) or blocking (such > as networking) operations, it should spawn its own thread in which to > do that work. More information on this can be found in the Threading > section of the Application Model overview. > > Should I using thread in the service to send data to server?
Any true background operations need to be off the main thread, particularly any that might take a while (e.g., slow Internet connection to the server). That could be: -- A secondary thread in a service -- A secondary thread in an activity -- Having the service be in a whole 'nuther process -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 1.1 Published! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

