Languages

Menu
Sites
Language
Service is getting terminated when it goes through tizen.messageport.requestRemoteMessagePort.

code:

module.exports.onStart = function() {
    // TODO: Do your initialization job 
    console.log("Start Callback");
    var remoteMsgPort = tizen.messageport.requestRemoteMessagePort("filQl7lFh3.serviceapp", "WebService");

    console.log("  I'm not getting executed :(   ");

}

 

After message port request service is getting terminated.

 

Is it a issue????

 

Responses

6 Replies
colin Rao

can you put the "var remoteMsgPort = tizen.messageport.requestRemoteMessagePort("filQl7lFh3.serviceapp", "WebService");" into a try...catch... block to check with exception. 

Prajith Premanandan

@colin:  i tried as u suggested its giving Exception message: "Applications port is not found"

any idea why its happening?? 

Marco Buettner

Have you define the localPort in the service?

Prajith Premanandan

@Marco i was just trying this sample

 https://developer.tizen.org/dev-guide/2.3.0/org.tizen.wearable.web.appprogramming/html/tutorials/service_tutorial/terminate_service.htm

followed the same code is there any thing extra i need to do

is it possible for the service to communicate with the same web app which holds it???

Marco Buettner

You have to define in service and mainapp always local and remote ports... The local port in the main app is the remote port in the service and in the service the local port is the remote port of the mainapp... 

colin Rao

Search from the help doc, seems you should get a instance local message port in your service app firstly, example,

 tizen.messageport.requestLocalMessagePort("WebService");

then, you can get this message port and send message to the service app in your client app.

    var remoteMsgPort = tizen.messageport.requestRemoteMessagePort("filQl7lFh3.serviceapp", "WebService");

    console.log("  I'm not getting executed :(   ");