Native Service Message Port can’t receive message from Web UI (Hybrid App)

Native Service Message Port can’t receive message from Web UI (Hybrid App)

BY 15 Sep 2019 Native Application Development

I am working on a Hybrid App (Web UI with Native Service) of API version 4.0 for my Gear S3 Frontier. 

I implemented the communication mechanism using Message Ports. Now here’s the workflow so far:

  • Web UI App is run.
  • By tapping on textbox, the Native Service App is launched successfully.
  • It sends the message successfully to the Web UI.
  • The Web UI receives the message, updates the screen and sends the message to the Service App.
  • The Service App gets crashed in response.

I’ve checked that the service app message callback function is called and I’ve received the bundle of size 1 (using bundle_get_count method) but when I try to get the message by “bundle_get_str” method, the serviceApp gets crashed. The log data related to message port communication between the two apps is given below:

Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_common.c: initialize_common(234) > init : spzIhJA8q2.MyApp
Info / MESSAGE_PORT ( 4024 : 4024 ) : message_port_common.c: initialize_common(234) > init : spzIhJA8q2.myservice
Info / MESSAGE_PORT ( 4024 : 4024 ) : message_port_local.c: send_message(1013) > sock pair : 18, 20
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_remote.c: __dbus_method_call_handler(811) > method_name: send_message
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_remote.c: __receive_message(666) > g_unix_fd_list_get 1 fd: [114]
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_remote.c: __on_sender_name_appeared(720) > sender name appeared : :1.
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_local.c: send_message(1013) > sock pair : 115, 116
Info / MESSAGE_PORT ( 4024 : 4024 ) : message_port_remote.c: __dbus_method_call_handler(811) > method_name: send_message
Error / MESSAGE_PORT ( 3909 : 3909 ) : message_port_common.c: read_socket(148) > read_socket: ...read EOF, socket closed
Error / MESSAGE_PORT ( 3909 : 3909 ) : message_port_common.c: read_string_from_socket(181) > read socket fail
Error / MESSAGE_PORT ( 3909 : 3909 ) : message_port_remote.c: __message_port_recv_raw(257) > read socket fail: port_name
Error / MESSAGE_PORT ( 3909 : 3909 ) : message_port_remote.c: __socket_request_handler(386) > recv error on SOCKET
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_remote.c: __socket_destroy_handler(428) > __socket_destroy_handler
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_local.c: __socket_disconnect_handler(383) > __socket_disconnect_handl
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_local.c: __free_port_info(190) > __free_port_info : remote_app_id : s
Info / MESSAGE_PORT ( 3909 : 3909 ) : message_port_local.c: __socket_destroy_handler(393) > __socket_destroy_handler
Warning / MESSAGE_PORT ( 2778 : 2778 ) : message_port_common.c: read_socket(153) > read_socket: 11 , sleep and retry ...
Warning / MESSAGE_PORT ( 3085 : 3085 ) : message_port_common.c: read_socket(153) > read_socket: 11 , sleep and retry ...

 

Written by