问题
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