| Reply | « Previous Thread | Next Thread » |
|
Hi everyone,
I know it's the Nokia forum, but I have a question about the SK5000. I'm trying to develop a simple application with HTTP connection. The problem is that after the download is finished, and the application automatically loads, the HTTP connection fails... BUT(!) when I start the application again (not the first time), it works perfectly!!! This bug is very strange, and I would be happy to hear any suggestions you might have. Thanks for your time!! |
|
Yes, this is a known problem on that phone. The first connection straight after the download ALWAYS fails. You'll have to put some code that retries the connection if it fails. The catch is, that you need to completely clean up all the objects related to the connection or it will fail again. So you have to close all the streams and connections, set them to null, run the garbage collector (System.gc()), and then try again. You should add a little delay (sleep for 500 ms or so) after the request for garbage collection and before you try again so the garbage collector has time to do it's stuff.
shmoove |
|
Hi Shmoove!
You helped me out before, and you're helping me out now! :) Thanks a lot man :) Say... Do you have a piece of code I can use that illustrates what you just said? It would be very helpful. By the way, how long does it take until I can use an HTTP connection? THANKS TONS! |
|
By the way,
this solution means that the user is UNAWARELY connecting to the internet... This means that it costs money to the user without him knowing it (especially on this phone, where he isn't asked for permission to conenct)... |
|
On this phone we always show a disclaimer at the beginning stating that the game will connect to the internet and the user will be charged. This is a requirement by Pelephone, and your game won't pass their QA without the disclaimer. The user can actually tell when all this is going on because the little phone icon on the top changes when a connection is being made.
Since you are in Israel you can try out our games (backgammon, checkers, battleships or snooker) to see what I'm talking about. I can't show you any actual code as it is in production, but it is pretty straight forward. When the connection fails an exception is thrown. So you have to catch that exception, make sure all the connection and stream objects have been closed and nulled, call System.gc(), sleep for a little while (with most of the SK models 350 ms was enough, but the SK5000 seems to need more time), and then try to connect again. shmoove |
|
Thanks!
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|