语言

Menu
Sites
Language
what's the difference between ui_app_main, app_main, and app_efl_main

As the title.

From their description in app.h, all of them are the main entry point of the Tizen application. 

I just guess, 

ui_app_main , this should be used in application with UI.

app_main, this should be used in application without UI.

app_efl_main, ?

Any one shold share on here, many thanks for your response.

响应

4 回复
Alex Dem

Hi,
Regarding apps without UI ( service apps) I suppose that you should use
service_app_main (both sdk examples use this) from <service_app.h> .
There is svc_app_main method also in <service_app.h> (I did not check how it works) and regarding description method is marked  @internal. I suppose you should use service_app_main in this case.
Alexey.

Alex Dem

Hi,
Regarding difference between ui_app_main, app_main, app_efl_main:
app_main & app_efl_main marked as @internal in <app.h>.
But even Some Native examples uses app_main (File Manager for example)
Main difference between app_main & ui_app_main is in incoming parameters :

1) ui_app_main uses as incoming param structure: ui_app_lifecycle_callback_s (there are listed callback functions:  create,terminate,pause, resume,app_control)
and to handle system events ( low memory or low battery e.t.c) you should add handlers this way:
 

//...
app_event_handler_h handlers[5] = {NULL, };
//...
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
//...

2) app_main (& app_efl_main) uses app_event_callback_s structre as incoming parameter( which contains additional callbacks low_memory,low_battery,device_orientation,language_changed,app_region_format_changed also)
all system handlers could be registedred this way:

    app_event_callback_s cbs =
    {
        .create = _on_create_cb,
        .terminate = _on_terminate_cb,
        .pause = _on_pause_cb,
        .resume = _on_resume_cb,
        .app_control = _on_app_control_cb,
        .low_memory = _on_low_memory_cb,
        .low_battery = _on_low_battery_cb,
        .device_orientation = _on_dev_orientation_changed_cb,
        .language_changed = _on_lang_changed_cb,
        .region_format_changed = _on_region_fmt_changed_cb
    };
   return app_main(argc, argv, &cbs, app);

3) Mention  of app_efl_main  I have found only in crash-info log (one of my apps). Looks like internal method.

I suppose recommended methods are ui_app_main for UI apps & service_app_main for Service apps.

Alexey.

colin Rao

I got it, many thanks for your response. 

Seems the app_main and app_efl_main are duplicated, although them incoming parameter are different from the ui_app_main, but we also can do the same action in another manner, such as call ui_app_add_event_handler to add extra event handler.

what's the difference use case scenario of them?

Alex Dem

Hi,
just Fyi:
In 2.3.0 dev-guide I just found one mention of app_main (Clock sample Simple & Comples view) and per me it looks like misprint. I suppose that we should use ui_app_main.
Alexey.