Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Companion App is not responding on Mobile but does work in simulator

ANSWERED

I have a watch face that used the companion app to determine distance based on gps coordinates.

 

I am calling the companion using

 

if (messaging.peerSocket.readyState === messaging.peerSocket.OPEN) {
messaging.peerSocket.send(data);
} else {
console.log("No peerSocket connection");
}

 

In the companion it takes data and then returns a json with gps info.

Code in companion to receive the message:

messaging.peerSocket.onmessage = function(evt) {
if (evt.data.key) {

....

 

If I use the simulator and the companion sim. This works perfectly. When I load this to the watch and phone, I don't see this happening. I have tried putting console.log() messages to see what is happening but I am not seeing any action.

I have run in background enabled.

 

My device is syncing with the phone no problem. I did notice that it is not showing up in the connected bluetooth devices list. 

 

Any thoughts/tips?

 

Thanks,

 

Paul

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

If console.log("No peerSocket connection")

then you should start a retry sending the data. I retry every 2 seconds

The simulator always has connection. the watch not so often. I often have connection problems with the Sense.

I guess the companion sends the date  (GPS) and your watch calls the companion.

You can do it in reverse when you have GPS on the watch of course.

Community Council MemberMario Dings | Rotterdam NL
Fitbit: Versa, Versa2, Sense. (Versa light) - Phone: Android. - Developer clockfaces.(Nederlands)

View best answer in original post

Best Answer
2 REPLIES 2

If console.log("No peerSocket connection")

then you should start a retry sending the data. I retry every 2 seconds

The simulator always has connection. the watch not so often. I often have connection problems with the Sense.

I guess the companion sends the date  (GPS) and your watch calls the companion.

You can do it in reverse when you have GPS on the watch of course.

Community Council MemberMario Dings | Rotterdam NL
Fitbit: Versa, Versa2, Sense. (Versa light) - Phone: Android. - Developer clockfaces.(Nederlands)
Best Answer

Thanks Mario! I will give that a try. I am getting the

 GPS data from watch, then sending to companion where it looks for the best match in json object with loads of entries. I'm basically using companion like database to host large data so it is not on watch side.

 

Thanks again, Paul

 

 

 

 

Best Answer
0 Votes