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

Sending random notifications to fitbit app

Hi, I am trying to build a clockface along with a companion. In my companion app a task will be running to select a date from a given list and upon reaching this date the companion app has to send a notification to to device app. I tried to do it buy using messaging api and setInterval function, but it is seen that on starting the application the device app and companion app will be connected through messaging api but  after 15 seconds the companion app will be unloaded and the messaging connection will be closed so i have used the wake-interval and loaded the companion again in certain intervals of time but even after waking the companion it is seen that the connection between the the device app and the companion app are not re-stored, which is a websocket connection as i understood so that i can not send the messages to the device app.  As i need to send messages to  device app from companion in random time, How will i establish the connection...?

Can anyone please help me in this issue as i am running short of time to  complete this.

Best Answer
0 Votes
2 REPLIES 2

As your clock is running on the device, I would just store the date on the device.

 

  • User selects the date within the Settings page and it gets persisted in settingsStorage automatically.
  • Companion listens for the settingsStorage onchange event and sends the selected value to the device via the messaging API.
  • The device listens for messages from the messaging API, saves values into the local filesystem.
  • Then use a tick event or interval on the device to check if the selected date has been reached.

Most of this is already in the Moment clock face example. https://github.com/Fitbit/sdk-moment

 

I hope that helps.

Best Answer
0 Votes

Thanks for the reply Jon, As i am using a method similar to the one you have suggested but my problem is that whenever my companion app gets unloaded the websocket connection between the device and the companion gets disconnected and it is re-connecting only after re-running the program.

Best Answer
0 Votes