- int ret = 0;
- char* app_id = NULL;
-
- int pid = getpid();
- ret = app_manager_get_app_id(pid, &app_id);
- if (ret != APP_MANAGER_ERROR_NONE) {
- LoggerE("Failed to get app id: %d (%s)", ret, get_error_message(ret));
- return false;
- }
-
- app_info_h handle;
- ret = app_info_create(app_id, &handle);
- free(app_id);
- if (ret != APP_MANAGER_ERROR_NONE) {
- LoggerE("Fail to get app info: %d (%s)", ret, get_error_message(ret));
- return false;
- }
-
- ret = app_info_get_package(handle, package_id);
- app_info_destroy(handle);
- if ((ret != APP_MANAGER_ERROR_NONE) || (*package_id == NULL)) {
- LoggerE("Fail to get pkg id: %d (%s)", ret, get_error_message(ret));
+ *package_id = common::CurrentApplication::GetInstance().GetPackageId();
+ if (package_id->empty()) {
+ LoggerE("Fail to get pkg id. Result is empty");