Search code examples
webtizen

How to get app control extra data from app control which made by web application in native?


I want to launch native application with data by app_control in web application. I can't find get app control extra data in my native application. I already tried to use 'app_control_get_extra_data', 'app_control_foreach_extra_data'.

Let me know how to get extra data from web application's app control.

In my web application,

    // Define the data structure describing application control details
    var appControl = new tizen.ApplicationControl(
                   "http://tizen.org/appcontrol/operation/default",
                   null,
                   null,
                   null,
                   [new tizen.ApplicationControlData("key",
                                                     ["data1", "data2"])] );

    // Launch an application with the specified application control
    tizen.application.launchAppControl(
            appControl,
            "net.msalt.myApplicationAppID",
            successCallback,
            errorCallback,
            appControlReplyCallback
        );

Solution

  • I got it! :)

    If 'data' length == 1, USE 'app_control_get_extra_data()'

        // In Web Application
        // Define the data structure describing application control details
        var appControl = new tizen.ApplicationControl(
                       "http://tizen.org/appcontrol/operation/default",
                       null,
                       null,
                       null,
                       [new tizen.ApplicationControlData("key",
                                                         ["data1"])] );
    
        //In Native Application
        char *value = NULL;
        ret = app_control_get_extra_data(app_control, "key", &value);
        if (ret != APP_CONTROL_ERROR_NONE) {
            dlog_print(DLOG_ERROR, LOG_TAG, "Failed to app_control_get_extra_data(). Can't get extra data.");
        } else {
            dlog_print(DLOG_ERROR, LOG_TAG, "data [%s]", value);
        }
    

    If 'data' length > 1, USE 'app_control_get_extra_data_array()'

        // In Web Application
        // Define the data structure describing application control details
        var appControl = new tizen.ApplicationControl(
                       "http://tizen.org/appcontrol/operation/default",
                       null,
                       null,
                       null,
                       [new tizen.ApplicationControlData("key",
                                                         ["data1", "data2"])] );
    
        //In Native Application
        char **array = NULL;
        ret = app_control_get_extra_data_array(app_control, "key", &array, &length);
        if (ret != APP_CONTROL_ERROR_NONE) {
            dlog_print(DLOG_ERROR, LOG_TAG, "Failed to app_control_get_extra_data_array(). Can't get extra data.");
        } else {
            dlog_print(DLOG_ERROR, LOG_TAG, "data [%s], [%s]", array[0], array[1]);
        }