You Are Here:

Community: Developer Discussion Boards

#1 Old SK5000 - Shot in the dark :) - 2004-07-28, 19:24

Join Date: Sep 2003
Posts: 37
itsik78
Offline
Registered User
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!!
Reply With Quote

#2 Old 2004-07-29, 09:08

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
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
Reply With Quote

#3 Old THANKS! - 2004-07-29, 09:23

Join Date: Sep 2003
Posts: 37
itsik78
Offline
Registered User
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!
Reply With Quote

#4 Old Your solution - 2004-07-29, 09:30

Join Date: Sep 2003
Posts: 37
itsik78
Offline
Registered User
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)...
Reply With Quote

#5 Old 2004-07-29, 11:34

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
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
Reply With Quote

#6 Old 2004-07-29, 14:57

Join Date: Sep 2003
Posts: 37
itsik78
Offline
Registered User
Thanks!
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia