Languages

Menu
Sites
Language
Is it possible to create webview in service native application?

Hello,

I would like to create a service application that opens webview with specified url. Unfortunately when I interact with Evas_Object I get errors. I dont have that problem when I change initialization method from service_app_main to ui_app_main. Does it mean that service application can't interact with UI elements and because of that I can't open webview?

 

Responses

3 Replies
Mango Bar

It is possible to open a UI app from service app. Firstly, don't forget to add the following privilege in your service app manifest file.

http://tizen.org/privilege/appmanager.launch

Then add the following code in your service_app_control method

void service_app_control(app_control_h app_control, void *data)
{

    app_control_create(&app_control);
    app_control_set_operation(app_control,APP_CONTROL_OPERATION_DEFAULT);
    app_control_set_app_id(app_control,"org.example.webviewexample"); // Second parameter will be your webview app ID

    // Log message to know the app launch status.
    
    if(app_control_send_launch_request(app_control,NULL,NULL)  == APP_CONTROL_ERROR_NONE)
        dlog_print(DLOG_INFO,"TAG","Succeded to launched WebView App.");
    else
        dlog_print(DLOG_INFO,"TAG","Failed to launched WebView App.");

    app_control_destroy(app_control);


    return;
}

Add your webview app ID in the second parameter of app_control_set_app_id(app_control, "YourWebviewAPPID") method.

Nibisz

It works. Thank you. Now I have a problem with packing multi projects. My main app is a web app that communicates with service app which opens native ui webview app. Web app cannot be packed with ui native app, only with services type. Do you know maybe how to solve that?

My case is that I need implement OAuth mechanism. From javascript level I don't have a possibility to do it so I need to create a native service. To perform OAuth I need to display webview with proper url so I need to have access to UI from native service. It's a little crazy but I can't figure out how to do it in other ways.

Mango Bar

According to following article, hybrid application only allows you native service or widget packaging with Web application.

https://developer.tizen.org/community/tip-tech/packaging-hybrid-application