Ok, thanks for this advice. So you decide to manage preference by yourself using the filesystem directly ?
On Fri, Jun 25, 2010 at 10:48 PM, Mariano Kamp <[email protected]>wrote: > Just a sidenote on an issue that you touch, but not the actual main issue: > > > - Save the cookie (String serialized into SharedPreferences) and > > create every time a new httpclient instance (then set the cookie to > > the new instance) => overhead to get the http connection > I tried that in my app and found out there is a huge performance penalty > involved as compared to just writing it to a file directly. I got the > impression if you set any preference and do a commit, then all the settings > are serialized into one single XML file and that's written to the very slow > flash memory. If you have, say 50 other settings, this may take 300-600ms > vs. 15 ms. Don't get hung up on the the actual numbers, just see the > difference in principle here. > Also when you have other stuff (the stream?) that you want to write, then > you're also clogging the flash memory. > > On Fri, Jun 25, 2010 at 4:46 PM, MoxFulder <[email protected]> wrote: > >> nobody has any idea ? >> >> On Jun 21, 10:33 am, MoxFulder <[email protected]> wrote: >> > Hi there, >> > I'm new using android sdk/httpclient >> > >> > I'm writing a small application which needs httpclient lib, basically >> > to manage the cookie/session automatically. >> > The website I'm targeting needs a valid session, so, between each http >> > call, I need to send the cookie. Httpclient does it well. This is a tv >> > stream application and I have to fetch the channel url, the url has a >> > token parameter and I have to be logged / authenticated / (=> have a >> > valid cookie/sessionid) to fetch the channel url. >> > >> > I got the first cookie/sessionid with the first connection to the >> > website. The cookie is valid for a certain amount of time, there is no >> > "expires" but I don't know if there is any server cron to cleanup the >> > sessions. I assume I have to "ping" every x secondes to maintain the >> > session valid. >> > >> > Between each http call, the time could be from 1 sec to several >> > minutes, it depends if the user wants to change the watched tv >> > channel. The http call (to fetch the url) is not made by the UI >> > Thread. >> > >> > There are several possibilities to manage the httpclient : >> > - a single httpclient static singleton instance accessed by a custom >> > synchronized getClient() on an helper class => when / how to release >> > the http connection ? How to handle that correctly if the user got a >> > phone call / does not use the application for now (unvalidate during >> > onResume, etc)? >> > - Save the cookie (String serialized into SharedPreferences) and >> > create every time a new httpclient instance (then set the cookie to >> > the new instance) => overhead to get the http connection >> > - other ? >> > >> > I'm asking here what is the best way to implement that. >> >> -- >> 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]<android-developers%[email protected]> >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 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] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

