System Information: Obtaining Device Information
This tutorial demonstrates how you can obtain device information, such as platform version, device model, and supported device features.
Warm-up
Become familiar with the System Information API basics by learning about:
-
Getting the Device Model Name
Get the model name of the device.
-
Checking Whether a Camera is Provided
Check whether the device provides a camera.
Getting the Device Model Name
To get the device model name:
-
To use the device-specific information-related features of the System Information API (in mobile and wearable applications), include the <system_info.h> header file in your application:
#include <system_info.h>
-
Device-specific information consists of "key, value" pairs. To get the device model name, use the http://tizen.org/system/model_name key.
The type of the value is String, which means that the system_info_get_platform_string() function is used for the information. The value of the key must be released by the free() function.
void func(void) { char *value; int ret; ret = system_info_get_platform_string("tizen.org/system/model_name", &value); if (ret != SYSTEM_INFO_ERROR_NONE) { // Error handling return; } dlog_print(DLOG_INFO, LOG_TAG, "Model name: %s", value); free(value); // Release after use }
Checking Whether a Camera is Provided
To check whether a camera is provided:
-
To use the device-specific information-related features of the System Information API (in mobile and wearable applications), include the <system_info.h> header file in your application:
#include <system_info.h>
-
To check whether the device provides any kind of a camera, use the http://tizen.org/feature/camera key.
The type of the value is bool, which means that the system_info_get_platform_bool() function is used for the information.
#include <stdbool.h> void func(void) { bool value; int ret; ret = system_info_get_platform_bool("tizen.org/feature/camera", &value); if (ret != SYSTEM_INFO_ERROR_NONE) { // Error handling return; } dlog_print(DLOG_INFO, LOG_TAG, "Camera: %s", value ? "Supported" : "Not supported"); }