This API is available on Firefox OS for privileged or certified applications only.
getDeviceStorage method is used to access some storage area available on the device.
This method gives access to a storage area from the device's default storage, that is the storage area whose
.default attribute is
true. This is controlled by the user via Settings App > Media Storage > Default media location (e.g. sdcard, internal memory, etc.) Alternatively, you can use the
getDeviceStorages method, which returns an
DeviceStorage objects, one per physical storage area.
Note: To be able to use a storage area, the application must declare it in its application manifest. For example, if the application wants to access the
sdcard storage area, it must have the "
device-storage:sdcard" permission in its manifest.
var instanceOfDeviceStorage = navigator.getDeviceStorage(storageName);
- The name of the targeted storage area. Firefox OS supports the following areas:
apps: This storage area is used to store the user data needed by apps. As it is critical data, accessing this storage area requires some extra privileges and is available for certified applications only.
music: This is the storage area where music and sounds are stored.
pictures: This is the storage area where pictures are stored.
sdcard: This is the storage area that gives access to the device's SDCard.
videos: This is the storage area where videos are stored.
This method returns a
DeviceStorage object that can be used to manage files on the associated storage area.
var sdcard = navigator.getDeviceStorage("sdcard");
Not part of any specification.
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.