Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6204219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:03:06+00:00 2026-05-24T05:03:06+00:00

Hey guys! Got a problem when I connect with a embedded device via bluetooth.

  • 0

Hey guys!

Got a problem when I connect with a embedded device via bluetooth.
When I connect with this code:

public void run() {
        Looper.prepare();
        try {
            // Connect the device through the socket. This will block
            // until it succeeds or throws an exception

                mmSocket.connect();
            if(!cancel){
                toMain = threadhandler.obtainMessage();
                toMain.arg1 = 1;
                threadhandler.sendMessage(toMain);
            }
        } catch (SecurityException e) {
            if(!cancel){
                Log.e("SecurityExcep", "Oh noes" , e);
                toMain = threadhandler.obtainMessage();
                toMain.arg1 = 2;
                threadhandler.sendMessage(toMain);
                Log.w("MESSAGE", e.getMessage());
            }
        }catch (IOException e) {
            //Bad connection, let's get the hell outta here
            try {
                Log.e("IOExcep", "Oh noes" , e);
                Log.w("MESSAGE", e.getMessage());
                if(!cancel){
                    mmSocket.close();
                    toMain = threadhandler.obtainMessage();
                    toMain.arg1 = 2;
                    threadhandler.sendMessage(toMain);
                }
                return;
            } catch (IOException e1) {
                Log.e("IOExcep2", "Oh noes" , e);
            }
        }
        try {
            mmSocket.close();
        } catch (IOException e) {
            Log.d("CONNECT_CONSTRUCTOR", "Unable to close the socket", e);
        }
        if(!cancel){
            toMain = threadhandler.obtainMessage();
            toMain.arg1 = 3;
            threadhandler.sendMessage(toMain);
        }
        Looper.loop();
        return;
        // Now it should be paired.. only thing to do now is let the user commit to the rest
    }

I search for the device, find it and then connect it via the mmSocket.connect(). After that the request is sent to the embedded device in which i enter the PIN. After that the request is sent to the phone were I a notification says that a device is trying to pair etc.

Firstly, it shouldn’t be a notification! It should be a dialog and I
guess it’s not my fault.

Secondly why do I get the following exception about 20 seconds after I recieve my notification:

07-28 11:13:00.537: ERROR/IOExcep(1064): Oh noes
07-28 11:13:00.537: ERROR/IOExcep(1064): java.io.IOException: Connection timed out
07-28 11:13:00.537: ERROR/IOExcep(1064):     at android.bluetooth.BluetoothSocket.connectNative(Native Method)
07-28 11:13:00.537: ERROR/IOExcep(1064):     at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:204)
07-28 11:13:00.537: ERROR/IOExcep(1064):     at com.se.mainActivity.ConnectThread.run(ConnectThread.java:61)
07-28 11:13:00.537: WARN/MESSAGE(1064): Connection timed out
07-28 11:13:00.537: INFO/MESSAGEHANDLER(1064): Message 2 recieved, on ConnectThread
07-28 11:13:00.567: ERROR/BluetoothEventLoop.cpp(234): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/377/hci0
07-28 11:13:00.567: ERROR/BluetoothEventLoop.cpp(234): event_filter: Received signal org.bluez.Adapter:DeviceRemoved from /org/bluez/377/hci0
07-28 11:13:00.567: DEBUG/BluetoothService(234): 00:0E:9F:88:A3:C1 bond state 11 -> 10 (9)
07-28 11:13:00.577: VERBOSE/BluetoothEventRedirector(1111): Received android.bluetooth.device.action.BOND_STATE_CHANGED
07-28 11:13:00.577: WARN/CachedBluetoothDeviceManager(1111): showUnbondMessage: Not displaying any message for reason:9
07-28 11:13:00.577: INFO/BluetoothEventLoop.cpp(234): agent_event_filter: Received method org.bluez.Agent:Cancel
07-28 11:13:00.627: VERBOSE/BluetoothEventRedirector(1111): Received android.bluetooth.device.action.PAIRING_CANCEL
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:03:06+00:00Added an answer on May 24, 2026 at 5:03 am

    Found out that it’s the embedded device that has a 20 sec wait time before it closes the socket and sends a exception thus terminating the pair-process

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, got a problem with a question. Question : Write a declaration for
Hey guys, I've got a neat dropdown menu and also a flashfile in my
Hey guys ive got the following Model for Accounts require 'net/http' require 'uri' require
Hey guys I got a weird issue.. I have a datalist that's only loaded
hey guys i got following error Undefined index: hname in C:\Temp\5Aug2010\job.php on line 38
Hey guys, I've got a few quick questions. Here is the site: link text
Hey guys, so I've got my NSFetchedResultsController working fine under the 3.1 SDK, however
Hey guys, I've been bashing my head around for hours now, over this login
hey guys, i'm getting an exception on the following inner exception: {Value cannot be
Hey guys i wrote a quick test. I want delete to call deleteMe which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.