int main(int argc, char *argv[]) { int ret; ui_app_lifecycle_callback_s event_callback = {0, }; app_event_handler_h handlers[5] = {NULL, }; event_callback.create = app_create; event_callback.terminate = app_terminate; event_callback.pause = app_pause; event_callback.resume = app_resume; event_callback.app_control = app_control; /* * If you want to handle more events, * please check the application life cycle guide. */ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, NULL); ret = ui_app_main(argc, argv, &event_callback, NULL); if (ret != APP_ERROR_NONE) dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() failed. err = %d", ret); return ret; }
int main(int argc, char *argv[]) { appdata_s ad = {0,}; int ret = 0; ui_app_lifecycle_callback_s event_callback = {0,}; app_event_handler_h handlers[5] = {NULL, }; event_callback.create = app_create; event_callback.terminate = app_terminate; event_callback.pause = app_pause; event_callback.resume = app_resume; event_callback.app_control = app_control; ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); ret = ui_app_main(argc, argv, &event_callback, &ad); if (ret != APP_ERROR_NONE) { dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret); } return ret; }
int Application::run(int argc, char** argv) { ui_app_lifecycle_callback_s event_callback = {}; event_callback.app_control = &Application::EventHandler::appControl; event_callback.create = &Application::EventHandler::appCreate; event_callback.pause = &Application::EventHandler::appPause; event_callback.resume = &Application::EventHandler::appResume; event_callback.terminate = &Application::EventHandler::appTerminate; app_event_handler_h handlers[5] = {}; ui_app_add_event_handler( &handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, Application::EventHandler::appLowBattery, this); ui_app_add_event_handler( &handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, Application::EventHandler::appLowMemory, this); ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, Application::EventHandler::appOrientChanged, this); ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, Application::EventHandler::appLangChanged, this); ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, Application::EventHandler::appRegionChanged, this); return ui_app_main(argc, argv, &event_callback, this); }
int main(int argc, char *argv[]) { appdata_s ad = { NULL, }; int ret = 0; ui_app_lifecycle_callback_s event_callback = {NULL,}; ad.name = "rubikscuge"; event_callback.create = app_create; event_callback.terminate = app_terminate; event_callback.pause = app_pause; event_callback.resume = app_resume; event_callback.app_control = app_control; ret = ui_app_main(argc, argv, &event_callback, &ad); if (ret != APP_ERROR_NONE) { dlog_print(DLOG_ERROR, LOG_TAG, "The application failed to start, and returned %d", ret); } return ret; }
int Application::run() { ui_app_lifecycle_callback_s event_callback = { nullptr, }; event_callback.create = app_create; event_callback.terminate = app_terminate; event_callback.pause = app_pause; event_callback.resume = app_resume; event_callback.app_control = app_control; /* ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]); */ int ret = ui_app_main(_argc, _argv, &event_callback, this); if (ret != APP_ERROR_NONE) { dlog_print(DLOG_ERROR, LOG_TAG, "The application failed to start, and returned %d", ret); } return ret; }