Question

I'm looking to get a clearer idea of the factors that affect the maximum allowed size of app messages incoming to the watch. The maximum size that the SDK guarantees will work is 124 bytes, and the docs say that "in some context, Pebble might be able to provide your application with larger inbox/outbox. You can call app_message_inbox_size_maximum() and app_message_outbox_size_maximum() in your code to get the largest possible value you can use."

I tried this out on my pebble and app_message_inbox_size_maximum() returned 2044 (which is more than enough for my app), but I imagine that's not reliable across pebbles? What is the "some context" the docs mention?

Was it helpful?

Solution

There are two factors that will impact how much memory is available:

  1. Are you talking to a JavaScript program or to a iOS/Android program using the PebbleKit iOS/Android libraries?

    In the case of JavaScript, you will have much more memory available because Pebble will use the same buffer that is used for installing apps and upgrading the firmware. Unfortunately the channel to communicate with third party apps written with the PebbleKit native libraries is much smaller (about 500 bytes).

  2. The version of Pebble OS you are using

    There will be small differences between versions but nothing major.

OTHER TIPS

When developing apps, I'd say the biggest thing to remember is that the message has to exist within your app's memory space while it's being processed. app_message_open allocates the space for you, which comes out of the 24kb that contains your app binary and app heap (see the Pebble Dev FAQ). So, ~2kB for AppMessages may or may not be a problem.

However, the app_message_xxx_size_maximum functions can't know how much RAM you are eventually going to use for other stuff. Since you can't resize the inboxes, you have to get it right the first time using your own judgement.

Beyond that, who knows. PebbleOS is closed source, so there's no easy way to figure out what's going on under the hood. But, we can try! First, since there is no way to check the in/outbox size, we might assume that the OS does not resize the inbox/outbox after it has been created. Then, since the OS does not allow >1 app to run at once, one could surmise that the size limits would be consistent across app launches on the same hardware. Finally, the maximum size should only get larger as time goes on, since reducing it would run the risk of breaking apps that relied on a particular size.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top