For framerate I'm talking about number of request by time unit. Each request I get messages and display it on map. I launch request only if map move
Thanks for your advices! On 3 sep, 21:39, hackbod <[EMAIL PROTECTED]> wrote: > I'm not sure what you mean by framerate... we are talking about http > requests, right? They shouldn't be tied to a frame rate. You really > need to think about the repercussions of running on a mobile device: > > - When on a EDGE network, it can easily take more than a second just > to set up a network connection. > - Opening a network connection puts the device in to a high power > state, and it will remain in that state for at least 10 seconds as it > expects more network traffic. This will drain the battery very > quickly. > - Even if you get the network connection up in time, it is doubtful > you will get all of your data back within 1 second. > > As a target, I would recommend trying to do a network connection no > more than once a minute (and this only when your app is in the > foreground; when in the background you want to be much more frugal > than that). In that connection, you can retrieve all of the > information around the current area that you might be interested in. > That is, batch your requests so that you can get a lot of data in a > small number of batches, to help mitigate the impact of network > connection delays and bringing the device in to a high power state by > performing network activity. > > Another option you can use is to keep a persistent connection open > while your app is in the foreground, which the server and client talk > back and forth on as needed. When there is no traffic on the > connection the device can go into a lower power state (though there is > still the delay so you still want to batch interactions as much as > possible), but this avoids the initial setup overhead. I'm not sure > how useful this is for doing repeated requests, except for getting rid > of the htttp and network setup overhead, but it can be very useful > when a server is pushing data to an app on the server's schedule. > > On Sep 3, 10:56 am, barbapapaz <[EMAIL PROTECTED]> wrote: > > > Hello it's for a map application you can see a video > > herehttp://www.youtube.com/watch?v=3cHyRdLi1D8 > > > What are rational framerate for this type of application? For example > > when you use google map or google earth what is methodology? > > > Thanks for your interest > > > On 3 sep, 18:34, hackbod <[EMAIL PROTECTED]> wrote: > > > > You are making an http request every second? Though I don't know what > > > you are doing, that seems way too frequent to me. This will be very > > > hard on the battery, effectively causing the device to keep its radio > > > turned on in a high power state for the entire time you are running. > > > > On Sep 3, 2:20 am, barbapapaz <[EMAIL PROTECTED]> wrote: > > > > > Hello > > > > > I have question about efficiency in loop. In my app I have loop called > > > > with sceduler each second. In this loop I launch request with > > > > httpclient, I must cronstruct an entity with MultipartEntity. > > > > > this procedure explain here (http://groups.google.com/group/android- > > > > developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c? > > > > lnk=gst&q=MultipartEntity#1284daa5723acd0c) > > > > > ContentBody[] parts = { new > > > > StringBody(Float.toString(latitudeMin)), > > > > > > > > new StringBody(Float.toString(latitudeMax)), > > > > > > > > new StringBody(Float.toString(longitudeMin)), > > > > > > > > new StringBody(Float.toString(longitudeMax)), > > > > > > > > new StringBody(dateMin), > > > > > > > > new StringBody(dateMax), > > > > > > > > new StringBody(noteMin), > > > > > > > > new StringBody(categories) > > > > }; > > > > > MultipartEntity getMessagesRequestContent = new > > > > MultipartEntity(); > > > > > > > > getMessagesRequestContent.addPart("latitudeMin", parts[0]); > > > > > > > > getMessagesRequestContent.addPart("latitudeMax", parts[1]); > > > > > > > > getMessagesRequestContent.addPart("longitudeMin", parts[2]); > > > > > > > > getMessagesRequestContent.addPart("longitudeMax", parts[3]); > > > > getMessagesRequestContent.addPart("dateMin", > > > > parts[4]); > > > > getMessagesRequestContent.addPart("dateMax", > > > > parts[5]); > > > > getMessagesRequestContent.addPart("noteMin", > > > > parts[6]); > > > > getMessagesRequestContent.addPart("categories", > > > > parts[7]); > > > > > In this code there are lot of "new" and the garbage collector is often > > > > called! > > > > MultipartEntity and StringBody objects aren't clear or erase function, > > > > I must called new each loop! > > > > > Do you think that is no problem? > > > > Do you think that I musn't use this new (do you have solution)? > > > > > MultipartEntity and StringBody objects are in an opensource library > > > > (code > > > > herehttp://hc.apache.org/httpcomponents-client/httpmime/xref/index.html). > > > > Do you think that I must write clear funtion to don't called new > > > > function (and recompile)? > > > > > Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

