Search code examples
tizentizen-native-app

Tizen: native service_app denies permission to send launch request?


I wish to send a call on Tizen5.5 wearable and the closest way I can reach is to open the dialer:

app_control_h request = 0;
app_control_create(&request);

app_control_set_operation(request, APP_CONTROL_OPERATION_CALL);
app_control_set_uri(request, "tel:0123456789");

error_code = app_control_send_launch_request(request, NULL, NULL);
dlog_print(DLOG_INFO, LOG_TAG, "app_control_send_launch_request: %d", error_code);

app_control_destroy(request);

However this always get me -13 which is PERMISSION_DENIED. Am I not allowed to launch from service app?

Manifest contains:

<privilege>http://tizen.org/privilege/call</privilege>
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>

Solution

  • You need to use the following API: https://docs.tizen.org/application/native/api/wearable/latest/group__CAPI__PRIVACY__PRIVILEGE__MANAGER__MODULE.html#ga3c2f09747f4db04d81b681c10935ee5f

    The call privilege is a privacy privilege. To obtain permission from Tizen security, calling the ppm_request_permission() is needed.

    e.g. calls ppm_request_permission()

    static void __ppm_request_response_cb(ppm_call_cause_e cause, ppm_request_result_e result, const char *privilege, void *user_data)
    {
      dlog_print(DLOG_ERROR, LOG_TAG, "privilege: %s, result: %d", privilege, result);
    }
    
    static int __foo(void)
    {
      int ret =  ppm_request_permission("http://tizen.org/privilege/call", ___ppm_request_response_cb, NULL);
      if (ret != PRIVACY_PRIVILEGE_MANAGER_ERROR_NONE) {
        dlog_print(DLOG_ERROR, LOG_TAG, "ppm_request_permission() is failed. error: %d", ret);
        return -1;
      }
    
      return 0;
    }