微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android-如何在Whatsapp之类的“我的文档”文件夹中添加文件?

我想在Android中创建类似whatsapp的目录来存储一些文件.但是我无法在android中创建文件.我只能在我的包中创建文件/目录(例如com.exampleapp.org)…

我的目标是在android 4.3的“我的文档”目录中添加一个文件

在我的AndroidManifest.xml中,我设置了以下权限:WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE.

有人知道吗?是否可以通过“仅”电话间隙实现?还是我需要一个插件

我正在使用cordova 3.4.

谢谢.

解决方法:

获取Documents目录,您应该使用Environment.DIRECTORY_DOCUMENTS.

要访问它:

Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)

Standard directory in which to place documents that have been created
by the user.

其他目录:

public static String DIRECTORY_ALARMS Standard directory in which to
place any audio files that should be in the list of alarms that the
user can select (not as regular music).

public static
String DIRECTORY_DCIM The Traditional location for pictures and videos
when mounting the device as a camera.

public static
String DIRECTORY_DOCUMENTS Standard directory in which to place
documents that have been created by the user.

public static
String DIRECTORY_DOWNLOADS Standard directory in which to place files
that have been downloaded by the user.

public static
String DIRECTORY_MOVIES Standard directory in which to place movies
that are available to the user.

public static
String DIRECTORY_MUSIC Standard directory in which to place any audio
files that should be in the regular list of music for the user. public
static String DIRECTORY_NOTIFICATIONS Standard directory in which to
place any audio files that should be in the list of notifications that
the user can select (not as regular music).

public static
String DIRECTORY_PICTURES Standard directory in which to place
pictures that are available to the user.

public static
String DIRECTORY_podcastS Standard directory in which to place any
audio files that should be in the list of podcasts that the user can
select (not as regular music).

public static
String DIRECTORY_ringtoneS Standard directory in which to place any
audio files that should be in the list of ringtones that the user can
select (not as regular music).

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐