androidbluetoothandroid-bluetooth

Delete Bluetooth received file programmatically


As the title says,

Is it possible to programmatically delete the Bluetooth received file list?

And if yes then, please provide a reference or a piece of code.

Thanks in advance

Ex: In the below picture I have only one item. Is it possible to delete it programmatically enter image description here


Solution

  • I had found so far two ways to make the programmatically delete the Bluetooth recent history list. Solution 1: (That works) Is to run the command pm clear com.android.bluetooth

    Solution 2: (Requires more work) I am trying to use in Android Manifest:

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

    And in the Java code:

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

    And

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