House
House

Reputation: 3496

What do I get java.io.IOException: Operation not permitted with my Android Bluetooth application?

When I try to create a socket in my Android application using the BluetoothSocket class, I get the following error:

java.io.IOException: Operation not permitted at android.bluetooth.BluetoothSocket.initSocketNative(Native Method)

How can I fix that?

Upvotes: 0

Views: 4547

Answers (1)

House
House

Reputation: 3496

Your permissions are not set up correctly. You need to ensure that you're allowing Bluetooth connections in your AndroidManifest file.

You can do that by modifying your manifest file in the following way:

<manifest ... >
  <uses-permission android:name="android.permission.BLUETOOTH" />
  ...
</manifest>

This will add Bluetooth to your apps permissions and allow you to create Bluetooth connections.

Upvotes: 5

Related Questions