首页 新闻 会员 周边

android手机开发蓝牙传输问题,求帮忙

1
悬赏园豆:10 [已解决问题] 解决于 2015-06-20 21:34

昨天参照了网上写了一段手机间蓝牙传输的代码,

1 ContentValues cv = new ContentValues();
2 String uri = "file://"+ mSendFileNameTV.getText().toString().trim();
3 cv.put("uri", uri);
4 cv.put("destination",mTouchObject.bluetoothDevice.getAddress());
5 cv.put("direction", 0);
6 Long ts = System.currentTimeMillis();
7 cv.put("timestamp", ts);
8 getContentResolver().insert(Uri.parse("content://com.android.bluetooth.opp/btopp"),cv);

可是运行到下面这行代码就报错了

1 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()

这个是什么原因造成的错误?有解决的方法么?

風过无痕的主页 風过无痕 | 初学一级 | 园豆:13
提问于:2014-12-31 10:35
< >
分享
最佳答案
0

log信息不是很清楚么?  requires  android.permission.ACCESS_BLUETOOTH_SHARE 

收获园豆:10
sphere | 菜鸟二级 |园豆:218 | 2015-06-11 15:54

加上了这个权限也不行

karry123 | 园豆:202 (菜鸟二级) | 2016-05-30 20:28
其他回答(1)
0

请问你怎么解决的

karry123 | 园豆:202 (菜鸟二级) | 2016-05-30 20:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册