09-25-2019 01:46 - edited 09-25-2019 03:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-25-2019 01:46 - edited 09-25-2019 03:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I am trying to get the communcation between a clockface and companion to work.
Currently it works in the OS simulator but when it is on a device and mobile via the private link in Fitbit Gallery App Manager, it doesn't work.
Ill breakdown what i do with the companion:
When the display is on i call to fetch an image
display.onchange = () => {
if (display.on) {
fetchImage();
}
}
The fetchImage function will send to the companion (This is the bit that isnt happening)
const fetchImage = () => {
if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
messaging.peerSocket.send({
command: 'image'
});
}
}
Finally, in my companion i check if the image is cached otherwise i fetch the image i need.
This works as it should when in the simulator but once it is on an actual phone and device the peerSocket.readState never appears to be OPEN.
When i log between the companion and app, it works exactly the same as the OS simulator but still no image unless in the simulator.
[11:00:24 AM] Companion: Successfully got data (companion/index.js:17,17)
[11:00:24 AM] Companion: Successfully got Ionic image data (companion/index.js:22,25)
[11:00:24 AM] Companion: send data back (companion/index.js:63,5)
[11:00:25 AM] App: Image Received (app/index.js:83,5)
[11:00:25 AM] App: Process images (app/index.js:33,9)
[11:00:55 AM] App: Ionic Received: ionic-image.png (app/index.js:37,17)
09-25-2019 02:27 - edited 09-25-2019 03:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-25-2019 02:27 - edited 09-25-2019 03:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
So from what i can tell everything is working as it should be.
Is it something to do with the image reference?
Currently it is referring to this:

