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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:38:18+00:00 2026-05-21T06:38:18+00:00

I have been challenged by a professor to develop a little Bluetooth Demo app

  • 0

I have been challenged by a professor to develop a little Bluetooth Demo app on Android. I knew nothing about developping for Android until 2 weeks ago when he gave me that challenge. I’m also quite new at Java programming in general, so I’m starting from far. But anyway…

So I did most of the tutorial, and I read about Bluetooth in Android, looked at the Bluetooth Chat sample code, and I’m now trying to do my little app. So for my demo, I will try to establish a connection between my real phone and my Bluetooth mouse. I want to move a shape on the screen of my phone in response to my mouse movement.

I encounter many problem, but so far my main one is to open a socket with my unsecure mouse. When I try using the method listenUsingRfcommWithServiceRecord, it ask a UUID as a parameter. But my mouse most likely doesn’t have a UUID to respond, so I guess this method is not the good one.

When I read the documentation about this method, it says that to open an unsecure server socket with a device like a mouse, I must use the listenUsingInsecureRfcommWithServiceRecord method. But this method is not available when I call it, it gets underlined in red and Eclipse says that it is undefined for the type BluetoothAdapter.

private BluetoothServerSocket connectDevice(BluetoothAdapter adapter, BluetoothDevice device){
    BluetoothServerSocket socket = null;
    try{
        socket = adapter.listenUsingInsecureRfcommWithServiceRecord(device.getName(), UUID.randomUUID());
    }
    catch(IOException e){
        Toast.makeText(this, "Connection failed.\n" + e.getMessage(), Toast.LENGTH_SHORT);
    }

    return socket;
}

Please don’t flame me if I’m doing it all wrong, it’s my first question here and I’m starting with Java programming.

  • 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-21T06:38:19+00:00Added an answer on May 21, 2026 at 6:38 am
    listenUsingInsecureRfcommWithServiceRecord()
    

    This is only available on API Level 10 and later, i.e., Android v2.3.3 onwards.

    That may be the problem if you’re building for a version previous to that.

    See to the right-hand side of the grey bar in the docs

    EDIT: In light of the fact it isn’t possible to extend BluetoothAdapter, listenUsingInsecureRfcommWithServiceRecord() simply does this…

    return createNewRfcommSocketAndRecord(name, uuid, false, false);
    

    The source for createNewRfcommSocketAndRecord() (which is a private method of BluetoothAdapter), can be found here…createNewRfcommSocketAndRecord

    Not sure if will help but you might be able to reproduce its functionality.

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

Sidebar

Related Questions

I have always been challenged by the way lists work and am confused about
I have been working on a web services related project for about the last
I have been recently challenged with writing a Windows Service. I needed to periodically
Im using a Core Data model for my iPhone app. I have been looking
I have been trying to implement a comment engine in my app (UItableView) but
We have a mailbox containing roughly 60,000 e-mails, and I've been challenged to pull
I have been scrounging for articles/info about the architecture at Facebook, the challenges &
I have been set a challenge to create an indexer that takes all words
Have been looking at the MVC storefront and see that IQueryable is returned from
Have been studying the file system related classes of Adobe AIR 1.5, but so

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.