This plugin provides the ability to query storage device information and be notified when a removable storage device is attached and detached.
In general, storage on mobile devices is handled differently than on desktop. The plugin is designed to provide consistent behaviour with desktop usage, but there are notable differences.
A summary of the similarities and differences:
-
Each mobile device has built-in storage (on both Android and iOS). This is reported as storage unit, similar to the physical hard drive in a desktop
-
Neither Android nor iOS officially support external storage attached via cable, like USB devices for desktops. Instead, both platforms expect only special-purpose accessories to be attached by cable (see Android and iOS)
-
Many Android devices will support an SD card for external storage. As of Android 4.4, the SDK has also added support for multiple SD cards. If found, the plugin will report any SD card(s) as storage units, similar to USB storage devices on desktop
The implementation of various functionality, across platforms, is summarized in the table below.
Method / Event | Android | iOS |
---|---|---|
getInfo | Yes | Yes1 |
ejectDevice | Yes2 | Yes |
getAvailableCapacity | Yes | Yes |
onAttached | Yes3 | No-op4 |
onDetached | Yes3 | No-op4 |
-
As iOS does not support generic storages devices, nor SD cards, this method will only ever return a single storage unit (representing built-in storage).
-
On Android, this method will always return "in use" for any removable storage - it is not currently supported to eject/unmount an SD card programmatically.
-
On Android, these events will start the app, even if it is not already running.
-
As above, no iOS devices support removable storage. Thus, these events are implemented as a no-op (listeners can be attached, but will never be fired).
The API reference is here.
- Renamed plugin to pubilsh to NPM
- Remove version constraint on backgroundapp dependency due to plugman bug CB-8696
- Use
org.chromium.backgroundapp
to handle background events
- Make Java 1.6 compatible
- Add Android support for ejectDevice, getAvailableCapacity, onAttached/onDetached
- Add iOS support for all methods/events
- Documentation updates.
- Initial release