一直获取不到写的权限,只有读的权限。
代码如下:
File f=new File(homedir,file); f.setExecutable(true, false); f.setReadable(true, false); f.setWritable(true, false); if(f.canWrite()) Log.i("rrrrrrr","file can write"); else Log.i("rrrrrrr","file cannot write"); f.delete(); this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(f)));
设备为Android 5.1.1电视,用es文件浏览器可以删除U盘文件,但是需要确认对话框,现尚无法查明该机制
Starting from Android 4.4, Google has introduced a new set of APIs, namely Storage Access Framework (SAF), a storage access framework that can be used to read and write content on the SD card.
Attachment:
stackoverflo related discussion thread