Languages

Menu
Sites
Language
[wearable] How can I check the specification and limitaion of web IME?

I'm suffering some troubles about developing web IME application.

 

As far I can check, some features and APIs for web app do not work for web IME application.

 

1. Listener for some types of hardware event such as rotary event(Blocking of back key on web IME seems to be definitely reasonable, but I can not understand why rotary event is also unavailable.)

2. Message Port APIs.(Someone mentioned about it on https://developer.tizen.org/forums/web-application-development/wearable-can-web-ime-communicate-native-service-app, but this answer seems to be wrong :( It didn't work)

 

I don't think that it is the list of all unavailble features, so I want to make my development scope clear.

 

What can I do, or can't with web APIs in web IME app? Is there any documentation which describes the specification and limitation of web IME APIs?

 

Thanks regards.

 

Edited by: GO U on 08 Aug, 2017
View Selected Answer

Responses

4 Replies
André Reus

hi 

Here are some docomentations for Tize IME, 

1. https://developer.tizen.org/development/guides/web-application/text-input/ime-application

2. http://developer.samsung.com/tv/develop/guides/user-interaction/keyboard-ime/#

IME is special type application. The goal is to provide users flexibility during text interation. To achieve this goal it doesn't need the features which you are talking about may be. Thats why, these are not in the feature list of IME api. 

Mark as answer
Armaan-Ul- Islam

Hello ~,

 

# It took some time, cause I decided to send message via Message Port to web IME application from native service myself to clarify the statement.

And Yes, I've successfully send message over Message port, So no Issue here.

 

Please make sure the service is in running state. Native service Code:

#include <message_port.h>
#define TAG "asd"

void
sendMessage(char *remote_app_id,char *remote_port,bundle *reply){

    int ret = message_port_send_message(remote_app_id, remote_port, reply);

	if (ret != MESSAGE_PORT_ERROR_NONE)
	    dlog_print(DLOG_ERROR, TAG, "message_port_check_remote_port error: %d", ret);
	else
	    dlog_print(DLOG_INFO, TAG, "Send message done");

	dlog_print(DLOG_INFO, TAG, "Send message was called");
}

void
test_check_remote_port(char *remote_app_id,char *remote_port,bool result)
{
    int ret;
    ret = message_port_check_remote_port(remote_app_id,remote_port,&result);
    if (ret != MESSAGE_PORT_ERROR_NONE)
        dlog_print(DLOG_ERROR, TAG, "message_port_check_remote_port error: %d", ret);
}

void msgPort()
{
	char *remote_app_id="ly7Hn3r0mz.IMEDoubleKeys";
	char *remote_port="CrossPort";
	bool result;

	test_check_remote_port(remote_app_id,remote_port,result);
	dlog_print(DLOG_DEBUG, TAG ,"Remote port exists: %s", result ? "true" : "false");

	bundle *reply;
	reply=bundle_create();

	bundle_add_str(reply,"test","A");

	dlog_print(DLOG_DEBUG, TAG, "Bundled Successfully");

	if (result){
		sendMessage(remote_app_id,remote_port,reply);
		bundle_free(reply);
	}

}

bool service_app_create(void *data)
{
	
	msgPort();  
    return true;
}

 

The Major point here is an IME application structure is not same as web application. The 'Fully Event Driven' nature of 'Input Method Editor' Application needs special attention on where to place the code.

 

For example implementation, I started from 'Sample > IMEDoubleKeys'. And invoked Message port functions from the function onKeyPressed(event).

function onReceive(data, remoteMsgPort) {
        console.log("Local port Listener Called");
    	
        for (var i = 0; i < data.length; i++){
            var keyX = data[i].key;
            alert("key:" + keyX);

            for (var j = 0; j < data[i].value.length; j++){
                var valueX = data[i].value[j];
                alert("value:" + valueX);        
            }
       }
             
    }
    
    function messagePort(){
    	 var localPort = tizen.messageport.requestLocalMessagePort("CrossPort");
    	 localPort.addMessagePortListener(onReceive);
    	 alert("Local port Listener Registered");
    }
    
    
    function onKeyPressed(event) {
    	 	
    	messagePort();
    	
        var keyCharacters = event.target.innerText,
        charsCount = keyCharacters.length;

        event.preventDefault();

        if (keyCharacters.length > 1 &&......

 

                             

GO U

It is best answer I've ever seen during I develop Tizen application! I'll try it. Thank you very much.

Armaan-Ul- Islam

# I would also recommend 'Preference API' to share data betwen web IME & native service application which I have also tested similarly. In that case the applications has to be packaged as 'Multi', both apps have to be under same package Id.

 

Get Preference Val:

function onKeyPressed(event) { 
    var currentValue = tizen.preference.getValue('int_key'); 
    alert('Val: ' + currentValue); 
    
    var keyCharacters = event.target.innerText, 
    charsCount = keyCharacters.....

 

Set Preference Val:

void setkey(){ 
    const char *integer_key = "int_key"; 
    int integer_value = 9; 
    
    bool existing; 
    preference_set_int(integer_key, integer_value); 
    preference_is_existing(integer_key, &existing); 
    dlog_print(DLOG_DEBUG,"myTag","key exits:%d", existing); 
    
} 
    
bool service_app_create(void *data) { 
    setkey(); 
    return true; 
    
}

 

https://developer.tizen.org/community/tip-tech/packaging-hybrid-application

https://developer.tizen.org/development/guides/web-application/application-management/application-preferences?langswitch=en&langredirect=1

https://developer.tizen.org/development/guides/native-application/application-management/application-preferences?langswitch=en&langredirect=1