当我要在sdcard中创建文件时。
DatabaseUtils:java.lang.IllegalStateException:无法触摸/mnt/media_rw/3365-3139/DCIM/Camera/.VID_20190422_031234844.mp4.tmp:java.io.IOException:只读文件系统
我在AndroidManifest.xml中具有添加权限
DocumentFile file = file = sdcardCameraDir.createFile("image/jpeg", ".VID_20190422_031234844.mp4.tmp");
这是例外:
04-22 03:12:34.860 24561 24844 E DatabaseUtils: Writing exception to parcel
04-22 03:12:34.860 24561 24844 E DatabaseUtils: java.lang.IllegalStateException: Failed to touch /mnt/media_rw/3365-3139/DCIM/Camera/.VID_20190422_031234844.mp4.tmp: java.io.IOException: Read-only file system
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at com.android.internal.content.FileSystemProvider.createDocument(FileSystemProvider.java:219)
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at android.provider.DocumentsProvider.callUnchecked(DocumentsProvider.java:1005)
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at android.provider.DocumentsProvider.call(DocumentsProvider.java:951)
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at com.android.externalstorage.ExternalStorageProvider.call(ExternalStorageProvider.java:611)
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at android.content.ContentProvider$Transport.call(ContentProvider.java:403)
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:272)
04-22 03:12:34.860 24561 24844 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:748)
我可以得到已经安装了SdCard的BroadcastReceiver(Intent.ACTION_MEDIA_MOUNTED);但是我无法在SdCard中创建文件。
如何检测到无法在SD卡上创建文件?