在非Root的安卓设备上创建USB文件夹?

huangapple 未分类评论64阅读模式
标题翻译

Create Folder in usb android non root device?

问题

无法在Android 5.0以上的非Root设备中通过此方法在USB存储上创建文件夹或文件。

File dest = new File("storage/usbotg/usbname/foldername");
dest.mkdir();

我将成功地使用以下NDK C代码在内部存储中创建文件或文件夹。

FILE* fp = fopen("/sdcard/sample.txt", "w+");

但是无法通过应用程序在USB存储中创建。

FILE* fp = fopen("/storage/2F5A-E677/sample.txt", "w+");
英文翻译

Unable to create a folder or file in USB storage android version above 5.0+ non-root device using this method

File dest = new File("storage/usbotg/usbname/foldername");
dest.mkdir();

I will successfully created a file or folder in internal storage using ndk c by below code .
FILE* fp = fopen("/sdcard/sample.txt","w+");

but unable to create usb storage via appliaction .

FILE* fp = fopen("/storage/2F5A-E677/sample.txt","w+");

huangapple
  • 本文由 发表于 2020年3月16日 16:54:50
  • 转载请务必保留本文链接:https://java.coder-hub.com/60702894.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定