以编程方式删除蓝牙接收文件

时间:2018-02-13 12:01:27

标签: android bluetooth android-bluetooth

正如标题所说,

  

是否可以以编程方式删除蓝牙接收的文件   列出?

如果是,那么请提供参考或一段代码。

提前致谢

Ex:在下图中我只有一个项目。是否可以通过编程方式删除它 enter image description here

1 个答案:

答案 0 :(得分:1)

到目前为止,我找到了两种方法来以编程方式删除蓝牙最近的历史记录列表。 解决方案1 ​​:(可行)是运行命令pm clear com.android.bluetooth

解决方案2 :(需要更多工作) 我想在Android Manifest中使用:

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

在Java代码中:

getApplicationContext().getContentResolver().delete(Uri.parse("content://com.android.bluetooth.opp/btopp"), null, null);

getApplicationContext().getContentResolver().delete(Uri.parse("content://com.android.bluetooth.opp/btopp3"), null, null);