Mobile native Wearable native

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

To get the device model name:

  1. 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>
    
  2. 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:

  1. 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>
    
  2. 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");
    }
    
Go to top