Capture image or movie from default camera application
Enable to take photo or record movie. Return path to created file.
// PRIVILEGE needed to be set in tizen-manifest.xml:
// http://tizen.org/privilege/appmanager.launch
void
open_switch_camera_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) {
char** path;
int length;
int ret;
if(result == APP_CONTROL_RESULT_SUCCEEDED) {
ret = app_control_get_extra_data_array(reply, APP_CONTROL_DATA_SELECTED, &path, &length);
if(ret == APP_CONTROL_ERROR_NONE) {
int i;
for(i=0; i<length;i++) {
LOGI("Captured file path: %s", path[i]);
free(path[i]);
}
free(path);
}
}
}
void
open_switch_camera() {
app_control_h app_control = NULL;
app_control_create(&app_control);
app_control_set_operation(app_control, APP_CONTROL_OPERATION_CREATE_CONTENT);
app_control_set_app_id(app_control, "tizen.camera");
app_control_set_mime(app_control, "*/*");
app_control_add_extra_data(app_control, "http://tizen.org/appcontrol/data/camera/allow_switch", "true");
if(app_control_send_launch_request(app_control, open_switch_camera_cb, NULL) == APP_CONTROL_ERROR_NONE)
LOGI("Switchable camera launched!");
app_control_destroy(app_control);
}