UUID of Obex Push Profile

后端 未结 1 1050
抹茶落季
抹茶落季 2021-01-16 17:44

I try to open a socket for listening for incomming connection from a non-android device.

 Parcelable[] uuidExtra = device.getUuids(); 
 String t = uuidExtra[         


        
相关标签:
1条回答
  • 2021-01-16 18:29

    So if anybody is curious about this, or facing the same issue as I did, here is the solution:

    The error: Not able to register SDP record for: "name of the device" will be thrown because you are trying to create a service with a a UUID that is already taken. In this case, I tried to register my own service, with the same UUID as the Obex Object Push

    What I had to do, is to register my own service, with a custom UUID, for instance

    d1b180c0-d7bc-11e1-9b23-0800200c9a66
    

    This UUID is generated from this webpage. As for now you have created a new listening socket:

         try {
            tmp = adapter.listenUsingInsecureRfcommWithServiceRecord("My Profile",   UUID.fromString("d1b180c0-d7bc-11e1-9b23-0800200c9a66"));
            } catch (IOException e) {
               Log.e("FAILED BECAUSE:", e.getMessage()); 
            } 
            mmServerSocket = tmp;
    

    And we are now ready to accept incomming requests, this way:

    socket = mmServerSocket.accept(); 
    

    Remeber, this is a blocking call, so for yourself and your users, please put this in a thread.

    So why the heck doesn't my device connect to the android server?

    1. Are you sure that the remote device/client is using the same UUID as the server?

    2. if you cant specify the UUID for the remote device, please contact the manufacture maybe the are nice enough to send you a config file, which is my case.

    If there is any questions, please add a comment to this post. I will accept this as an answer since nobody had a solution to this.

    0 讨论(0)
提交回复
热议问题