昨天参照了网上写了一段手机间蓝牙传输的代码,按 Ctrl+C 复制代码ContentValues cv = new ContentValues();String uri = "file://"+ mSendFileNameTV.getText().toString().trim();cv.put("uri", uri);cv.put("destination",mTouchObject.bluetoothDevice.getAddress());cv.put("direction", 0);Long ts = System.currentTimeMillis();cv.put("timestamp", ts);可是运行到下面这行代码就报错了getContentResolver().insert(Uri.parse("content://com.android.bluetooth.opp/btopp"),cv);看了下logcat的信息显示java.lang.SecurityException: Permission Denial: writing com.android.bluetooth.opp.BluetoothOppProvider uri content://com.android.bluetooth.opp/btopp from pid=10194, uid=10056 requires android.permission.ACCESS_BLUETOOTH_SHARE, or grantUriPermission()这个是什么原因造成的错误?有解决的方法么?
- 2 回答
- 0 关注
- 913 浏览
添加回答
举报
0/150
提交
取消