Pick image example

Pick image and as result return path
//    PRIVILEGE needed to be set in tizen-manifest.xml:
//    http://tizen.org/privilege/appmanager.launch

#include <dlog.h> // for logging purposes
#include <app_control.h>


void
pick_image_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) {
	char* path;

	if(result == APP_CONTROL_RESULT_SUCCEEDED) {
		if(app_control_get_extra_data(reply, "path", &path) == APP_CONTROL_ERROR_NONE)
			LOGI("Selected image path: %s", path);
	}
}

void
pick_image() {
	app_control_h app_control = NULL;
	app_control_create(&app_control);
	app_control_set_operation(app_control,  APP_CONTROL_OPERATION_PICK);
	app_control_set_mime(app_control,  "image/*");
	if(app_control_send_launch_request(app_control, pick_image_reply_cb, NULL) == APP_CONTROL_ERROR_NONE)
	   LOGI("Gallery launched!");
	app_control_destroy(app_control);
}

Responses

0 Replies