View selected file with device default viewer

Open selected file using device default viewer. Audio, image, video, document etc. files can be viewed if only application supporting specified file format is available on device.
//    PRIVILEGE needed to be set in tizen-manifest.xml:
//    http://tizen.org/privilege/appmanager.launch

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


void
view_file(char* path) {
	app_control_h app_control = NULL;
	app_control_create(&app_control);
	app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW);
	app_control_set_uri(app_control, path);
	if(app_control_send_launch_request(app_control, NULL, NULL) == APP_CONTROL_ERROR_NONE)
	   LOGI("Viewer launched!");

	app_control_destroy(app_control);
}

Responses

0 Replies