×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    5

    Question localDevice .setDiscoverable(DiscoveryAgent.GIAC) failed! the progrem is blocked

    When I try a blutooth demo, I encountered some problems at starting booth connection;
    the code as follows;
    try
    {
    System.out.println("$$$ getLocalDevice start 1");
    LocalDevice localDevice = LocalDevice.getLocalDevice();


    System.out.println("$$$ setDiscoverable start 2");

    localDevice .setDiscoverable(DiscoveryAgent.GIAC);

    System.out.println("$$$ setDiscoverable sucess 3 ");

    }
    catch(BluetoothStateException e)
    {
    System.out.println("$$$ setDiscoverable failed 4 ");
    String msg = "Error changing inquiry access type: " +
    e.getMessage();
    ErrorScreen.showError(msg, settingsList);
    }

    when I execute this code in nokia emulator, the midlet progrem is blocked , console messages only as follows:

    System.out.println("$$$ getLocalDevice start 1");
    System.out.println("$$$ setDiscoverable start 2");

    the trace message 3 or 4 cant't be printed forever , so I think the progrem is blocked;


    What's the problem with the code? Or some configurations of my emulator cause the problem;

    Please help me! Thank you!


    the emulator is Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S40_128x160_MIDP_Emulator;
    my develop platform is Eclipse + Nokia_Prototype_SDK_4_0 + carbide1.0

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    I would guess you do not get a BluetoothStateException. Try again with a catch block for Throwable or at least with Exception. Additionally, I would use a Platform SDK, only.

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    5

    Red face Re: localDevice .setDiscoverable(DiscoveryAgent.GIAC) failed! the progrem is blocked

    I change my code:

    As follows:

    try
    {
    System.out.println("$$$ getLocalDevice start 1");
    LocalDevice localDevice = LocalDevice.getLocalDevice();


    System.out.println("$$$ setDiscoverable start 2");

    localDevice .setDiscoverable(DiscoveryAgent.GIAC);

    System.out.println("$$$ setDiscoverable sucess 3 ");

    }
    catch(Exception e) //this is the change code
    {
    System.out.println("$$$ setDiscoverable failed 4 ");
    String msg = "Error changing inquiry access type: " +
    e.getMessage();
    ErrorScreen.showError(msg, settingsList);
    }


    but the result is the same as before; No any exception can be catched! The progrem is blocked;
    your annother suggestion is to use other platform sdk! Can you tell which sdk is corret? How can I use them! Thank you!

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2003
    Posts
    4,105
    It depends on which phone (model and/or series) you are targeting. Please read …

  5. #5
    Registered User
    Join Date
    Aug 2006
    Posts
    5

    Re: localDevice .setDiscoverable(DiscoveryAgent.GIAC) failed! the progrem is blocked

    After I change the Nokia device Lib, The problem disappeared! Thank you!

Posting Permissions

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