언어 설정

Menu
Sites
Language
Not able to simulate key events in Message app using Tizen::Ui::SystemUtil::GenerateKeyEvent

Hi,

I have created sample application that will launch Message app, which inturn generates and sends KEY_1 using Tizen::Ui::SystemUtil::GenerateKeyEvent().

Code Snippet of the code:

String strAppName = L"tizen.messages";
result r;

Tizen::App::AppControl* pAc = AppManager::FindAppControlN(strAppName, L"http://tizen.org/appcontrol/operation/compose");
if (pAc)
{
	r = pAc->Start(null, null, null, null);
	delete pAc;
}
AppLog("Application launch status : [%s]", GetErrorMessage(r));

sleep(2);

Tizen::Ui::KeyCode keyToSimulate = Tizen::Ui::KEY_1;

r = Tizen::Ui::SystemUtil::GenerateKeyEvent(Tizen::Ui::KEY_EVENT_TYPE_PRESSED, keyToSimulate);
AppLog("KEY_EVENT_TYPE_PRESSED [%d] and result :: %s", keyToSimulate, GetErrorMessage(r));
r = Tizen::Ui::SystemUtil::GenerateKeyEvent(Tizen::Ui::KEY_EVENT_TYPE_RELEASED, keyToSimulate);
AppLog("KEY_EVENT_TYPE_RELEASED [%d] and result :: %s", keyToSimulate, GetErrorMessage(r));

Application launched successfully and the result of the GenerateKeyEvent pressed and released is E_SUCCESS. The value '1' is not getting printed on the Message app.

Please help me to simulate the keys.

Thanks,

Anil.

Responses

4 댓글
Anil Kumar

I can able to simulate the events successfully upon giving some characters manually. For the first time as soon as application lauched though the corresponding filed has focus i cant simulate events.

Thanks,

Anil

Sathya Priya R

I have used the same code and facing the same issue. The result E_Success but there is no key event simulated.

I have checked for privileges and there is "inputmanager" added.

Could you throw some light on this? Have you added some specific changes to the code or privileges, to get it working?

Please comment.

Thanks,

Priya

 

 

 

 

 

Anil Kumar

Priya,

As i said in my previous post, type some text manually before generating the events using GenerateKeyEvent API. 

Anil

 

Sathya Priya R

Hi Anil,

Thank you.

It works this way.

Thanks,
Priya