昨天參照了網上寫了一段手機間藍牙傳輸的代碼,按 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 關注
- 950 瀏覽
添加回答
舉報
0/150
提交
取消