File Picker

File Picker

BY 11 Aug 2015 Native Application Development

Hi, I am porting a Nintendo Gameboy Color emulator. I want to provide the users the option to pick a “.gb” or “.gbc” file. The “clicked” callback of the button and the result callback of app control looks like this.

static void app_control_result(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
{
    char *value;
    if(result == APP_CONTROL_RESULT_SUCCEEDED)
    {
        int ret = app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &value);
        if ( ret == APP_CONTROL_ERROR_NONE)
        {
            dlog_print(DLOG_INFO, LOG_TAG, "[app_control_extra_data_cb] Succeeded: value(%s)", value);
        }
        else
        {
            dlog_print(DLOG_ERROR, LOG_TAG, "[app_control_extra_data_cb] Failed: Error code: %d", ret);
        }
    }
    else
    {
        dlog_print(DLOG_ERROR, LOG_TAG, "[app_control_result_cb] APP_CONTROL_RESULT_FAILED. Error code: %d", result);
    }
}



void clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
    appdata_s *ad = data;


    app_control_h app_control;
    app_control_create(&app_control);
    app_control_set_operation(app_control, APP_CONTROL_OPERATION_PICK);
    app_control_send_launch_request(app_control, app_control_result, ad);
    app_control_destroy(app_control);
}

Picking a file with the built in file explorer I get : [app_control_extra_data_cb] Failed: Error code: -126

I have added mediastorage, externalstorage and other data related privileges in the manifest file. What am I doing wrong?

Written by