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 7014421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:31:08+00:00 2026-05-27T22:31:08+00:00

I need to setup an in-app OBEX server on an Android 2.3 device. Using

  • 0

I need to setup an in-app OBEX server on an Android 2.3 device. Using the Bluetooth Chat Sample code I was able to setup an OBEX server. However, the server needs to use a custom UUID so the service is not registered as an ‘OBEX Server’

# sdptool browse local
...(snip)...
Service Name: OBEX Object Push
Service RecHandle: 0x10000
Service Class ID List:
  UUID 128: ab123abc-1a2b-3c4d-5d7f-1234567890ab
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 18

So, when I receive data, it looks like I am receiving a raw OBEX connection request:

80 00 07 10 00 04 00 00 00 00 ...(snip)... 00 00 00 (1kb file)

Is there an OBEX implementation that I can use or do I have to implement the protocol myself?

I don’t want to use the inbuilt OBEX server – this has to be in app. I have tried BlueCove but I abandoned it when I had issues registering a service.

Yes, I did see this post and read the link in it, but by golly, there must be an easier way!

  • 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-27T22:31:08+00:00Added an answer on May 27, 2026 at 10:31 pm

    I ended up implementing the protocol myself. It wasn’t as hairy as I imagined. Since I was expecting only a specific client to connect and I knew that the client would only be pushing one file I was able to partially implement only the sections of the protocol that I needed.

    Some documentation that helped with understanding the OBEX protocol were Obex13.pdf at: http://gitorious.org/gammu/gsm-docs/trees/e5161a75fb1e1c1608959b27ae3c3940bcf0911b/standards/obex

    A quick snippet of how I parsed the sockets input stream:
    (Note OBEXUtils and OBEXConstants are my classes.)

    try
    {
        //Read all bytes passed in
        bytes = mmInStream.read(buffer);
    
        //Ensure we have the entire packet before we proceed
        // Packet length is in the 1st and 2nd byte
        expectedLength = OBEXUtils.bytesToShort(buffer[OBEXConstant.LENGTH_IDENTIFIER],
            buffer[OBEXConstant.LENGTH_IDENTIFIER + 1]);
    
        packetLength = bytes;
    
        //Keep reading until we get what we expect.
        while (packetLength < expectedLength)
        {
            bytes = mmInStream.read(buffer, packetLength, maxPacketSize);
            packetLength += bytes;
        }
    
        //Switch on Packet Header
        switch (buffer[OBEXConstant.HEADER_IDENTIFIER])
        {
            case OBEXConstant.CONNECT:
                //Parse the packet and return an acknowledgement packet
                write(OBEXConnect.parsePacket(buffer));
                break;
    
            case OBEXConstant.PUT:
            case OBEXConstant.PUT_FINAL:
                //Parse the PUT packet and return an acknowledgement packet
                //For Parsing PUT packets I referred to the android and bluecove implementations
                write(putPacket.appendPacket(buffer, packetLength));
                break;
    
            case OBEXConstant.DISCONNECT:
                //Parse the packet and return an acknowledgement packet
                write(OBEXDisconnect.parsePacket(buffer));
                break;
    
            case OBEXConstant.GET:
            case OBEXConstant.GET_FINAL:
            case OBEXConstant.SETPATH:
            case OBEXConstant.SETPATH_FINAL:
            case OBEXConstant.SESSION:
                //Did not implement these
                break;
    
            case OBEXConstant.ABORT:
                Log.w(Constant.TAG, TAG + "ABORT Request Received");
                isDisconnected = true;
                break;
    
            default:
    
                break;
        }
    }
    catch (final IOException e)
    {
        ...(snip)...
    }
    

    Snip of OBEXConstant:

    public static final byte FINAL_BIT = (byte) 0x80;
    
    public static final byte CONNECT = 0x00 | FINAL_BIT; //*high bit always set Connect choose your partner, negotiate capabilities
    public static final byte DISCONNECT = 0x01 | FINAL_BIT; //*high bit always set Disconnect signal the end of the session
    public static final byte PUT = 0x02; //(0x82) Put send an object
    public static final byte PUT_FINAL = PUT | FINAL_BIT;
    public static final byte GET = 0x03; //(0x83) Get get an object
    public static final byte GET_FINAL = GET | FINAL_BIT; //(0x83) Get get an object
    public static final byte SETPATH = 0x05;
    public static final byte SETPATH_FINAL = SETPATH | FINAL_BIT;
    public static final byte SESSION = 0x07;
    public static final byte ABORT = (byte) 0xFF;
    
    public static final byte OBEX_RESPONSE_CONTINUE = (byte) 0x90;
    public static final byte OBEX_RESPONSE_SUCCESS = (byte) 0xA0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to setup NACHOS java version in Linux and run some simple sample
im using themes in an app im doing, and need a global css/img/js folder
I want to setup the App Engine Dev Server, so that it's available to
I need to setup a web app in JBoss to load html files directly
currently I need to setup a production Django app in my computer and I
I am building an app for which I need to set up cron jobs.
I need to setup LookAndFeel Files in JDK 1.6. I have two files: napkinlaf-swingset2.jar
I need to setup an application that watches for files being created in a
I need to setup a simple IVR system for a friend's company that will
I need to setup an ASP.Net MVC view with a Date Picker that will

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.