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

Phone Disconnect Vibration Warning in Watchface

Is it feasible to have a vibration warning built into a watchface that my phone has disconnected from the watch?  One of the last features I'm trying to implement from the watchface I had with the Pebble Time is this warning that I've set down my phone and am wandering away from it.

 

My latest attempt to implement this comes from guidance offered in this thread:

https://community.fitbit.com/t5/SDK-Development/Phone-Security/td-p/2259443

 

I've added a check of the status of the messaging peer socket on each clock tick to my watchface and created a companion app that just opens the socket, but I'm running into two issues:

1. The connection does not seem at all reliable and frequently breaks, especially when the watchface goes into low power mode.

2. Any vibration I try won't fire when the watchface is in low power mode.

 

Is there a way to structure this to give the vibration warning no matter what state the watch is in?

Best Answer
19 REPLIES 19

Not until Fitbit decides to fix bluetooth reliability issues. Until then it's not going to work and welcome to the club.

Best Answer
0 Votes

Don’t forget the ontick event doesn’t fire when the display is off.

 

An ontimeout however will. You may even choose to reduce how often you check for companion app acknowledging the conection which should reduce impact on battery life,

 

As @paperinik says, currently the Bluetooth connectivity is quite flaky and is a known issue “across many layers of the platform”. We are awaiting firmware update.....

Best Answer
0 Votes

The new firmware update has already begun rolling out, and if you don't yet see the update, it should be available sometime this week.

Best Answer

@JonFitbit Can’t wait Smiley Very Happy

Best Answer
0 Votes

"Update available". Looking into it.

Best Answer
0 Votes

@paperinik Where do you see that message?

 

@thinkbui Apologies for the thread hijack.....

Best Answer
0 Votes

In the fitbit app (I have iOS). I don't know if I clicked on the Ionic.

Best Answer

Back in topic:
I don't know if polling is the right solution. You poll too often and the battery is going to drain quickly. You poll not that often and it's useless.

Pebble had a convenient onBluetoothConnectionChange event. You should ask for something similar being available. That will guarantee that your watchface gets notified in a timely fashion vs. constantly polling.

Best Answer
0 Votes

Huh, never considered that it might just be the ontick that's killing everything in low power mode.  I'll have to try triggering a vibration with an ontimeout when I get a chance.

Best Answer
0 Votes

wrote:

Back in topic:
I don't know if polling is the right solution. You poll too often and the battery is going to drain quickly. You poll not that often and it's useless.

Pebble had a convenient onBluetoothConnectionChange event. You should ask for something similar being available. That will guarantee that your watchface gets notified in a timely fashion vs. constantly polling.

And yeah I'd rather not poll.  It's been awhile since I've even looked at the source code of my Pebble Time's watchface, but I think I remember using bluetooth events when I built it.  Since that's not available for the Ionic yet, I'm hoping to use polling as a stopgap measure.  I already charge my watch daily while I'm in the shower, so hopefully the drain won't be faster than that.

Best Answer
0 Votes

@SunsetRunner

I've created a crude recursive setTimeout function that does the polling once per second and can confirm that the vibrations do work with the screen off as long as it's not tied to the ontick event, so thank you for reminding me about it.

 

@paperinik

I have noticed overnight that this polling function does indeed drain the battery faster, about 2-3 times faster so far, but I'll have to keep monitoring it through normal use.

Best Answer
0 Votes

After about a week of having the crude polling function, I actually haven't noticed a lot of battery drain.  I agree that it's still not a good idea to do it this way and will change it when better means become available, but so far the only higher battery drain I've been seeing is when I forget to disconnect the Developer Bridge.

 

Something else might be draining the battery overnight as I woke up this morning with it at 94% after it was fully charged when I went to bed, but I'm not seeing that during the day, so it's probably not the polling.

 

I'm still trying to figure out how to use the Haptics API correctly to get a vibration pattern instead of a brief jolt, but that's probably a separate discussion.

Best Answer
0 Votes

Not sure if you are talking a custom pattern, but the standard patterns are defined here: https://dev.fitbit.com/build/reference/device-api/haptics/

Best Answer
0 Votes

@SunsetRunnerwrote:

Not sure if you are talking a custom pattern, but the standard patterns are defined here: https://dev.fitbit.com/build/reference/device-api/haptics/


Yeah I've been trying to use one of the standard patterns.  The problem I'm running into is that no matter which one I use, I only get a single split-second jolt for each time "vibration.start([pattern])" is called as though something else is immediately calling "vibration.stop()" or the vibration variable is being destroyed and re-instantiated in a way I don't understand.

Best Answer
0 Votes

What is the polling frequency you are using?

Best Answer
0 Votes

@paperinikwrote:

What is the polling frequency you are using?


1000ms

Best Answer
0 Votes

@thinkbui

Let me restate. You are pinging the companion every second?? And that's not draining the battery on the watch?

Best Answer
0 Votes

@paperinikwrote:

@thinkbui

Let me restate. You are pinging the companion every second?? And that's not draining the battery on the watch?


Not noticeably.  In the last day alone, I charged it up to full and put it on before I went to bed last night and woke up with it at 92% 7 hours later.  Now 12 hours of checking stats and notifications periodically throughout the day, it's only fallen to 84%.

 

If the watch is checking the status of the connection that was initiated by the phone, is it actually pinging my phone when it does that?

Best Answer
0 Votes

No, but I would expect that each time the phone pings the watch some battery gets drained in order for the watch to be woken up. Usually these things are meant to running in a suspended state for as long as possible in order to preserve battery. Bottom line, I would be expecting different draining patterns. Or I don't really know what is going on...

Best Answer
0 Votes