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

  • Home
  • SEARCH
  • 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 6737475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:15:11+00:00 2026-05-26T11:15:11+00:00

I just started learning Android development. I am writing an Android program to scan

  • 0

I just started learning Android development. I am writing an Android program to scan available bluetooth devices and list them in a log file. As I am new to Android, I am unable to figure out what is wrong in the below code snippet.

 button2.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {
                ListView lv1 = (ListView) findViewById(R.id.myListView1);
                BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();


                final BroadcastReceiver mReceiver = new BroadcastReceiver() 
                { 
                    public void onReceive(Context context, Intent intent) 
                    {
                        String action = intent.getAction(); 
                        // When discovery finds a device 
                        if (BluetoothDevice.ACTION_FOUND.equals(action)) 
                        {
                        // Get the BluetoothDevice object from the Intent 
                        BluetoothDevice device = intent.getParcelableExtra(
                        BluetoothDevice.EXTRA_DEVICE);
                        Log.v("BlueTooth Testing",device.getName() + "\n"
                        + device.getAddress()); 
                        }
                    }    
                };

                String aDiscoverable = BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE;
                startActivityForResult(new Intent(aDiscoverable),DISCOVERY_REQUEST);
                IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); 
                registerReceiver(mReceiver, filter); 
                mBluetoothAdapter.startDiscovery();
            }
        });

When I try the debug mode, the control skips the “BroadcastReceiver()“. I could not find any entries in the log. Can you help me in figuring out what the problem is and how I can list the available bluetooth devices.

[edit]
I am getting error that the application has stopped unexpectedly:

Logcat Errors:
10-28 20:08:24.201: ERROR/UpdateReceiver(914): ACTION_PACKAGE_REMOVED
10-28 20:08:28.415: ERROR/RequestPermissionActivity(431): Timeout = 120
10-28 20:08:44.291: ERROR/DTUN_HCID4(521): === dtunops_stop_discovery() ===
  • 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-26T11:15:12+00:00Added an answer on May 26, 2026 at 11:15 am

    You should have the BLUETOOTH and BLUETOOTH_ADMIN permissions in your manifest

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

Sidebar

Related Questions

I'm familiar with C++ but never used Java. I've just started learning Android development.
I've just started learning Android development and as a little project, I'm building a
So I just started learning Android and I am reading the commonsware android development
I just started a new Android project, WeekendStudy to continue learning Android development and
I just started learning how to program for android and cant seem to get
I have just started learning to write apps for android using Eclipse. Where can
I just started learning HTML5, I started with normal text file and changed its
I just started learning C++ and I wrote this sample program from the text
I have just started learning android. And i don't know How can I change
I just started learning opengl and writing a first person shooter but I'm getting

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.