Samsung Web API enables you to access the device's system properties (both hardware and capability) using the SystemInfo API. You can obtain various device and system details, such as the current battery level, amount of available storage, and state of the cellular network connection.
The main features of the SystemInfo API include:
- Property state checks
You can retrieve the current state of a specific device property by using the getPropertyValue() method.
The property state can determine whether your application has enough resources to complete a particular task or service successfully. For example, if you are creating a file, you need to check the storage property to know whether a writable storage is available on the device.
- Property state updates
You can receive state updates when a change occurs in a specific property.
The addPropertyValueChangeListener() method registers an event listener for a specific property, and returns the subscription identifier for the listener. You can use the SystemInfoPropertySuccessCallback interface to define the event handler for receiving the change notification.
The system properties are defines as subtypes of the SystemInfoProperty interface. The following table lists the available subtypes, and the related PropertyId type values.
Property | PropertyID | Description |
---|---|---|
SystemInfoBattery | BATTERY | Provides information about the battery level and charging status. With this property, you can, for example, determine whether the application can be launched or whether the user needs to be warned about the level of power available for the device. |
SystemInfoCpu | CPU | Provides information about the CPU load, allowing you to determine the efficiency of an application. |
SystemInfoStorage | STORAGE | Provides information about the currently connected data storage devices and their details, such as available capacity. With this property, you can, for example, allow the user to select which available storage they want to use, and determine whether the storage in question has enough free space for the actions the user wants to perform. |
SystemInfoDisplay | DISPLAY | Provides information about the device display, allowing you, for example, to determine the resolution of the device to layout your application optimally on runtime. |