×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2009
    Location
    Gdansk, Poland
    Posts
    139

    Telling if a device I am running on has a keyboard

    Hello everybody,

    My app can be controlled both by keyboard and by touch, and runs on purely keybord-only devices such as Asha 302, touch and type (can be controlled both ways) and the purely touch-based devices like the Asha 501. If a device has no keyboard , there is no point to display a lot of parts of the UI however (like a small tutorial how to control the game with a keyboard ). For this reason, I would like to be able to tell if the device I am running on has any type of keyboard and only display those parts of the UI then. To wit:

    private boolean hasKeyboard()
    {
    //if running on Asha 501, 311 (anything else? ) return false
    // otherwise return true (does not matter if the keyboard is a T9 or a QWERTY or whatever )
    }

    How to implement my function?

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,560

    Re: Telling if a device I am running on has a keyboard

    See the "System properties for keypad settings" section in http://www.developer.nokia.com/Resou...roperties.html

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Telling if a device I am running on has a keyboard

    The Java Library is not yet updated and still very Symbian when it comes to this. Does this help?
    Code:
    System.getProperty("com.nokia.keyboard.type").equals("OnekeyBack")
    Nokia 501, new Asha software platform
    Code:
    System.getProperty("com.nokia.keyboard.type").equals("None")
    This is a Series 40 full-touch device, like the Nokia 311.
    For me, all devices before that return null.

  4. #4
    Registered User
    Join Date
    Mar 2009
    Location
    Gdansk, Poland
    Posts
    139

    Re: Telling if a device I am running on has a keyboard

    Yes, exactly like traud is saying - the theory looks good, but in practice one hits a typical problem with Nokia - on most devices this is not implemented. Eventually I settled for
    Code:
     private static final int KEYBOARD_T9   = 1;
     private static final int KEYBOARD_4_10 = 2;
     private static final int KEYBOARD_3_11 = 3;
     private static final int KEYBOARD_HALF = 4;
     private static final int KEYBOARD_NONE = 5;
    
     private int keyboardType;
    
     private void detectKeyboardType()
        {
        keyboardType = KEYBOARD_T9; 
    
        String platform = System.getProperty("microedition.platform");
    
        if( platform != null )
          {
          if( platform.indexOf("NokiaE71"  ) != -1 ||
              platform.indexOf("NokiaE61"  ) != -1 ||
              platform.indexOf("NokiaE63"  ) != -1 ||
              platform.indexOf("NokiaE72"  ) != -1 ||
              platform.indexOf("NokiaC3-00") != -1 ||
              platform.indexOf("Nokia302"  ) != -1  ) { keyboardType = KEYBOARD_4_10; return; }
    
          if( platform.indexOf("NokiaE55"  ) != -1  ) { keyboardType = KEYBOARD_HALF; return; }
          if( platform.indexOf("NokiaN97"  ) != -1  ) { keyboardType = KEYBOARD_3_11; return; }
          }
        
        String keyboard = System.getProperty("com.nokia.keyboard.type");
    
        if( keyboard != null )
          {
               if ( keyboard.indexOf("HalfKeyboard")        != -1 ) keyboardType = KEYBOARD_HALF;
          else if ( keyboard.indexOf("LimitedKeyboard4x10") != -1 ) keyboardType = KEYBOARD_4_10;
          else if ( keyboard.indexOf("LimitedKeyboard3x11") != -1 ) keyboardType = KEYBOARD_3_11;
          else if ( keyboard.indexOf("None")                != -1 ) keyboardType = KEYBOARD_NONE;
          else if ( keyboard.indexOf("OnekeyBack")          != -1 ) keyboardType = KEYBOARD_NONE;
          }
        }
     
      public boolean noKeyboard()
        {
        return keyboardType == KEYBOARD_NONE;  
        }

    Sad you always have to resort to this kind of tricks with Nokia.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Telling if a device I am running on has a keyboard

    Thank you for sharing your code! I would not use keyboard.indexOf but keyboard.equals because even Nokia engineers use equals. You never know what the future brings …

Similar Threads

  1. Replies: 12
    Last Post: 2013-02-08, 12:13
  2. Signed Application is running in S40 device but not on S60 device
    By senthil_25 in forum Mobile Java General
    Replies: 5
    Last Post: 2011-04-12, 05:53
  3. Application running on emulator but not running on Device
    By syedshakeel2004 in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 3
    Last Post: 2010-09-28, 13:55
  4. App running as the first and locking keyboard
    By techLearner in forum Mobile Java General
    Replies: 4
    Last Post: 2006-08-01, 18:11
  5. Telling the EXACT version of Carbide Express
    By jasoneverson in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2006-05-03, 07:05

Posting Permissions

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