I am working on a Hybrid App (Web UI with Native Service) of API version 4.0 for my Gear S3 Frontier.
- The Web UI launches the Service.
- Native Service uses the Sensor and Location data.
My Service App has the privilege of Senor and Location in the manifest file. When I check the privileges in code, the results show that I need to get privilege from user, which is perfectly fine.
I've implemented it using the Privacy Privilege Manager but when I request for privilege using the ppm_request_permission method, it doesn't show any message asking for the permission, and so it doesn't go the ppm_request_response_cb method.
Here's the relevant code:
Response Handler Implementation:
void ppm_request_response_handler(ppm_call_cause_e cause, ppm_request_result_e result, const char *privilege, void *user_data) { dlog_print(DLOG_DEBUG, TAG, "In the ppm_request_response_handler."); /* * The result of a response triggered by calling ppm_request_permission() is a valid value only if * the cause parameter is equal to PRIVACY_PRIVILEGE_MANAGER_CALL_CAUSE_ANSWER. */ if(cause == PRIVACY_PRIVILEGE_MANAGER_CALL_CAUSE_ANSWER) { if(result == PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER) { if(!strcmp(privilege, "http://tizen.org/privilege/location")) { bIsLocationPrivilegeGranted = true; dlog_print(DLOG_DEBUG, TAG, "Service Application has been granted the Location privilege."); } if(!strcmp(privilege, "http://tizen.org/privilege/healthinfo")) { bIsHealthInfoPrivilegeGranted = true; dlog_print(DLOG_DEBUG, TAG, "Service Application has been granted the Health Info privilege."); } } else { if(!strcmp(privilege, "http://tizen.org/privilege/location")) { dlog_print(DLOG_DEBUG, TAG, "Service Application is denied to access the Location."); } if(!strcmp(privilege, "http://tizen.org/privilege/healthinfo")) { dlog_print(DLOG_DEBUG, TAG, "Service Application is denied to access the Health Information."); } } } else { if(!strcmp(privilege, "http://tizen.org/privilege/location")) { dlog_print(DLOG_DEBUG, TAG, "Service Application did not get any response to access the Location."); } if(!strcmp(privilege, "http://tizen.org/privilege/healthinfo")) { dlog_print(DLOG_DEBUG, TAG, "Service Application did not get any response to access the Health Information."); } } } typedef void(* ppm_request_response)(ppm_call_cause_e cause, ppm_request_result_e result, const char *privilege, void *user_data);
Method Call to Request for Permission:
//Set the function pointer value ppm_request_response ppm_request_response_cb = ppm_request_response_handler; //Request the user for the permission ppm_request_permission(requiredPrivileges[i], ppm_request_response_cb, NULL);
Expected Behaviour:
Service App should show any message asking the user about the permission, the ppm_request_response_handler method should be invoked then to handle the response of the user.