Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    I'm doing j2me stock price applicaton. I want to give a http request to the server and get the price from server. I got the price.

    But my question is when i click refresh command, i want to update the price for every 5 seconds.

    1. how can i give continous http request for every 5 second.?

    2. when i connect to server, always asking permission to connect the server, how can i avoid that dialog..?

    Note : I'm using J2MEPolish TableItem to update the prics.

    Help me,
    kumar.

  2. #2
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    Quote Originally Posted by kumar1234567 View Post

    2. when i connect to server, always asking permission to connect the server, how can i avoid that dialog..?


    On real devices it wont shw all time just press allow for session and to refesh it put a timer and rerun the thread

  3. #3
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    Code:
    if (c == refresh) {
                timer = new Timer();
                timertask =  new MyTimerTask();
                timer.schedule(timertask,1000,1000);
            }
    In run() method of the timer class I have http connection to get the price.

    Code:
            public void run() {
                downloadPage(url);      
            }
    For every sec, its asking permission dialog to connect http, and values also not changing. how to solve this?

    please help me,
    kumar

  4. #4
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    Actually device should not ask for it, i have designed so may applications that connect to server n no of times at first time only device asks and once it is set to "allow for session" it wont ask any further on which device you are testing have you tried testing on other devices .

  5. #5
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    Thanks prssupe,

    ya! but I tried timer for one minute, values are not changing in the table. its remains same.

    how to change the values in the table when i refresh, that is again send data to the server..?

    how can i solve this..?

  6. #6
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    What i request you is increase timer to to five minute or more value test it once again .if the problem gets solved then it is the issue of cache being stored in the mobile else problem might be at server side

  7. #7
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    Thanks for ur reply,

    Another doubt..?

    When i perform http connection in command handling listerner like,

    Code:
     if (cmd == cmdSend) {
                   sendHttpPost(EnteredID); 
    			}
    I got this error
    Warning: To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler
    I know this is come only in emulator not in real devices. Right now, My testing team is testing apps in emulator only.

    how can i avoid this in emulator..?

    is this possible .?

    kumar

  8. #8
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    use threads in your application ,by Doing that above warning would not be shown and even it is good design practice also help your application to work on devices smoothly
    Last edited by prssupe; 2011-06-04 at 14:00.

  9. #9
    Regular Contributor kumar1234567's Avatar
    Join Date
    Aug 2010
    Location
    Chennai, India.
    Posts
    176
    ya i tried using thread in the command action, but request is not sending to the server. Its blank.

    How can i solve this?

  10. #10
    Registered User prssupe's Avatar
    Join Date
    Dec 2009
    Posts
    376
    keep code as
    if (cmd == cmdSend) {
    new Httppost().start();

    }


    where the threads name will be httppost

Similar Threads

  1. Same(Duplicate) HTTP request through J2ME app
    By raviborawake in forum Mobile Java Networking & Messaging & Security
    Replies: 11
    Last Post: 2011-06-08, 03:02
  2. Suggestion about http request..?
    By kumar1234567 in forum Mobile Java General
    Replies: 1
    Last Post: 2011-05-28, 14:41
  3. Nokia ~ Suggestion Regarding GSM Call Trace
    By sakibnaz in forum General Development Questions
    Replies: 1
    Last Post: 2010-11-04, 06:05
  4. MMS informations regarding te GET WSP/HTTP request
    By alinesimon in forum General Messaging
    Replies: 3
    Last Post: 2009-09-01, 13:01
  5. Kind request: suggestion
    By JWONokia in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2007-01-16, 14:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved