×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    29

    Strange behaviour with connection to 3G network

    Hello J2ME gurus,

    I am enclosing an example midlet. If you run it in your phone and click 'test' , the midlet will download (http) Google's front page. Just before the download, the phone will , of course, connect to 3G network (duh!) and a white '3G' icon will appear in the top-left corner.

    The problem is that even after the download finishes, the icon does NOT disappear no matter how long one waits (I tried 10 minutes). The icon only disappears when one exits the midlet.

    Question: why is that? isn't the phone supposed to automatically disconnect after some time of inactivity, say, 1 min?

    AFAIK, there are only 2 possibilities:

    1) there is something wrong with the code below ( hopefully ) or
    2) if a midlet performs network operation, nokia's phones will stay connected no matter how long you run the midlet and only disconnect when you exit it. ( that would suck )


    PHP Code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import java.io.*;

    public class 
    TestDownload extends MIDlet implements CommandListenerRunnable
      
    {
      private 
    Display mDisplay;
      private 
    TextBox mTextBox;
      private 
    Command mTestCommandmExitCommand;
      private static 
    Thread mNetworkThrd null;

      private 
    HttpConnection  hc  null;
      private 
    DataInputStream din null;

      public 
    TestDownload()
        {
        
    mTestCommand = new Command("Test"Command.SCREEN1);
        
    mExitCommand = new Command("Exit"Command.EXIT, 1);

        
    mTextBox = new TextBox("Test"""32TextField.ANY);
        
    mTextBox.addCommand(mTestCommand);
        
    mTextBox.addCommand(mExitCommand);
        
    mTextBox.setCommandListener(this);
        }

      public 
    void startApp()
        {
        
    mDisplay Display.getDisplay(this);
        
    mDisplay.setCurrent(mTextBox);
        }

      public 
    void pauseApp() { }

      public 
    void destroyApp(boolean unconditional) {}

      public 
    void commandAction(Command cDisplayable s)
        {
        if (
    == mTestCommand)
          {
          
    mTextBox.setString("Downloading...");
          
    mNetworkThrd = new Thread(this);
          
    mNetworkThrd.start();
          }
        if (
    == mExitCommandnotifyDestroyed();
        }

      public 
    void run()
        {
        try
          {
          
    hc= (HttpConnection)Connector.open("http://www.google.com");
          
    int length = (int)hc.getLength();
          
    byte[] data null;

          if( 
    length != -)
            {
            
    data = new byte[length];
            
    din = new DataInputStreamhc.openInputStream() );
            
    din.readFully(data);
            }

          
    mTextBox.setString("data downloaded, length:"+length);
          }
        catch( 
    IOException ioe )      { mTextBox.setString("IOException"      ); }
        catch( 
    SecurityException se ) { mTextBox.setString("SecurityException"); }
        
    finally
          
    {
          try { if( 
    din!=null ) {din.close(); din=null; } }
          catch(
    IOException ioe) { mTextBox.setString("Exception closing din");}
          try { if(  
    hc!=null ) { hc.close();  hc=null; } }
          catch(
    IOException ioe) { mTextBox.setString("Exception closing hc"); }
          }
        }
      } 

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Smile Re: Strange behaviour with connection to 3G network

    Hi,
    That happen on most of the devices.I have read somewhere that the upcoming devices will not behave like that.You are talking about 3G network,even in the case of the GPRS this is the case.And I wonder if that can be get rid of.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Strange behaviour with connection to 3G network

    There is nothing obviously wrong with the code.

    A number of other people have reported the same issue. Certainly, some Nokia devices will disconnect after a brief delay. Possibly, some do not. What model are you using?

    Staying connected does no harm, unless you're using full-screen mode, in which case the presence of the "G" icon is annoying.

    On some (all?) Series 40s, pressing the END key while the "G" icon is showing will end the connection. (A second press will terminate the application as normal.)

    Graham.

  4. #4
    Nokia Developer Champion
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Strange behaviour with connection to 3G network

    to shut down the connection on a S60 you can go tho the home (default? screen) by pressing the menu button and the you can press the red button for some time after which the ongoing interent connection will be closed (you will even get an Alert asking you if you're sure if you want to close the connection)...
    this is obviously no solution and you cannot expect your users to do such a complex handling, but you might test with it to see if the connection symbol dissapears

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    29

    Re: Strange behaviour with connection to 3G network

    I have tested with Nokia 3120 and 6220 ( physical devices ) and with a bunch of devices from RemoteDeviceAccess ( N95, E71, 63xx XpressMusic and some others ) - everywhere the same.

Similar Threads

  1. Strange problem with Network connection
    By gigglie in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2008-02-21, 07:29
  2. Network connection type
    By onlyabhi in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-10-24, 09:07
  3. Strange IAP behaviour
    By demasi.m1nd in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-10-11, 02:19
  4. S60 2nd Ed. FP2 wins udeb - No network connection
    By timomon in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-12-03, 16:08
  5. Forcing 6630 to logon to 3G network
    By biatch0 in forum General Development Questions
    Replies: 1
    Last Post: 2006-01-02, 14:40

Posting Permissions

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