Ticket Created
over 3 years ago

CIQQA-990

Device simulator phone app message crash

I'm trying to use Communications.PhoneAppMessage and I'm following the example given in the Toybox API documentation as:

using Communications;
// set up somewhere to store the message
var message = new Communications.PhoneAppMessage;
// set up phoneMessageCallback
function phoneMessageCallback(msg) {
message = msg.data;
}
// register the messages from the callback to capture the results
Communications.registerForPhoneAppMessages(method(:phoneMessageCallback));

In the Connect IQ Device simulator, I use the menu entry: Simulation/Phone App Message and I enter {"my message"}. The simulator crash with:
Error: JSON Error
Stack:

Encountered app crash.

On macOs 12.2.1 with connectiq-sdk-mac-4.0.9-2022-01-24-2154651d3

Parents
  • While trying different things, I realize that if I send the following message the app don't crash:
    {
    "data":"My message"
    }

    Then, msg.data.toString() = "{data=>My message}"

    Is there some special requirement on the structure of the message? If so, it would be nice to clarify in the documentation since it is not clear from the Toybox.Communications.PhoneAppMessage description.

Comment
  • While trying different things, I realize that if I send the following message the app don't crash:
    {
    "data":"My message"
    }

    Then, msg.data.toString() = "{data=>My message}"

    Is there some special requirement on the structure of the message? If so, it would be nice to clarify in the documentation since it is not clear from the Toybox.Communications.PhoneAppMessage description.

Children
No Data