On click of hardware button of mobile then it should exit from TIZEN application

匆匆过客 提交于 2019-12-14 02:53:10

问题


I have developed tizen application and i want to use hardware button,once user click on hardware button it should exit from application.I am developing TIZEN application.The hardware back button of my application is not working.


回答1:


There are two type of application is exist in TIZEN (2.3)

If you make web application,

document.addEventListener('tizenhwkey', function(e) {
    if(e.keyName == "back") {
        try {
            tizen.application.getCurrentApplication().exit();
        } catch (error) {
            console.error("getCurrentApplication(): " + error.message);
        }
    }
});

but if you want native application, you can get back button event with EFL Extension API

#include <efl_extension.h>

static void
win_back_cb(void *data, Evas_Object *obj, void *event_info)
{
    appdata_s *ad = data;
    /* Let window go to hide state. */
    elm_win_lower(win);
}

eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);


来源:https://stackoverflow.com/questions/31109440/on-click-of-hardware-button-of-mobile-then-it-should-exit-from-tizen-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!