Android Bluetooth error
If you are working on an Android Java/Kotlin code and trying to use the Bluetooth device of the phone and while running the app you get a Runtime Exception saying "Unable to start activity Need BLUETOOTH permission", well then you have missed adding the user permission to provide access to Bluetooth, add the below line in the AndroidManifest.xml file under the manifest node,
<uses-permission android:name="android.permission.BLUETOOTH" />
Error Stack trace:
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.code2care.testing/com.code2care.testing.MainActivity}:
java.lang.SecurityException: Need BLUETOOTH permission:
Neither user 10123 nor current process has android.permission.BLUETOOTH.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2560)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2626)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
Caused by: java.lang.SecurityException: Need BLUETOOTH permission:
Neither user 10123 nor current process has android.permission.BLUETOOTH.
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at android.bluetooth.IBluetooth$Stub$Proxy.isEnabled(IBluetooth.java:853)
at android.bluetooth.BluetoothAdapter.isEnabled(BluetoothAdapter.java:701)
at com.code2care.testing.MainActivity.isBluetoothEnabled(MainActivity.java:26)
at com.code2care.testing.MainActivity.onCreate(MainActivity.java:17)
at java.lang.reflect.Method.invoke(Native Method)
More Posts related to Android,
- Change Android Toast background color
- Maven : java.lang.ClassNotFoundException: Xmx512m
- This class should be public (android.support.v7.internal.widget.ActionBarView.HomeView) Lint Error
- Android Alert Dialog with Checkboxes example
- Android Error Generating Final Archive - Debug Certificate Expired
- How to add Newline to text in Android TextView
- Read Text file from SD Card : Android Programming
- [FIX] AndroidRuntime: FATAL EXCEPTION: main - java.lang.RuntimeException NullPointerException
- ActivityManager Warning: Activity not started, its current task has been brought to the front
- INSTALL_FAILED_INSUFFICIENT_STORAGE Android Error
- Android Developers Bluetooth Tutorial
- java.lang.ClassNotFoundException android.support.v7.widget.Toolbar [Fix]
- Android: Save Data in local Db using Android Room
- Channel 50 SMSes received every few minutes Android Phones
- 21 Useful Android Emulator Short-cut Keyboard Keys
- Changing Android Intent Tittle using java code
- Android : No Launcher activity found! Error
- How to change TextView or EditText Text Color on Focus and on Press
- How to display Toast on Button Click : Android
- Android : Execute some code after back button is pressed
- Stop android adb service from command prompt or terminal
- [Soluiton] You already have the latest version of Android Studio installed
- Create Custom Android AlertDialog
- Android R Cannot Be Resolved To A Variable
- How to make Android EditText not editable
More Posts:
- How to create Toast messages in Android? - Android
- [macOS] Change homepage Macbook Safari Browser - MacOS
- How to Adjust macOS System Font Size - MacOS
- Sharepoint Server 2016 installation Prerequisites with download links - SharePoint
- Set width and height for the label in tkinter - Python
- Share Image to WhatsApp with Caption from your Android App - WhatsApp
- Error : Facebook SDK AndroidRuntime?FATAL EXCEPTION: main - Android
- Android Studio emulator/Device logCat logs not displayed - Android-Studio