0

In my bluetooth application i got the below exception anyone can help to solve this.

08-29 13:07:08.370: E/DatabaseUtils(31342): java.lang.SecurityException: Permission Denial: writing com.android.bluetooth.opp.BluetoothOppProvider uri content://com.android.bluetooth.opp/btopp from pid=9760, uid=10110 requires android.permission.ACCESS_BLUETOOTH_SHARE, or grantUriPermission()

My manifest file is

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="process.bluetooth.sendfile"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="7"
    android:maxSdkVersion="17"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.BLUETOOTH" android:label="BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

<permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE"
    android:protectionLevel="signature" />

<application android:icon="@drawable/bluetooth" 
    android:label="@string/app_name"
    android:allowBackup="true">
    <activity android:name="process.bluetooth.sendfile.SendFileActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

Arut
  • 940
  • 14
  • 32

1 Answers1

1

if you are trying it for Android 4.1 or above, then the permission to write directly to the content provider is now protected with "signed" meaning you would have to sign your app with the same key used to sign the bluetooth app.

Source this answer on almost similar question Android bluetooth print stopped working on 4.1 . See link for solution.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124
  • i am not using that intent type i am using the bluetoothShare class for send file..you mention answer is perfectly working already done that. – Arut Aug 29 '13 at 07:47
  • also i am using android 2.3 as well as 4.3 – Arut Aug 29 '13 at 07:49