Watch does not vibrate on background task

I am trying to vibrate the watch when a certain condition is met.
To reproduce the issue, here is a simple bit of code and scenario.

Code (WebAPI):

    tizen.humanactivitymonitor.start('GPS', data => {
      for (const gpsData of data.gpsInfo) {
          var speed = gpsData.speed;
          if (speed > 15) {
            // this does not work, watch never vibrates
    }, error => {
      console.log('Oops, something went wrong: ', error);
    }, {callbackInterval: 1000, sampleInterval: 1000});

Start the “app” wait for the watch to go back to the “watch face”.
Meet the condition specified in the background task.
The watch does not vibrate.

The watch vibrates ONLY IF the app is visible and active.

What should I do here? Should I use the “Feedback” API instead? How do I use this?

Tizen WebAPI Vibration - Source


A tiny bit of progress on this issue.
It now vibrates even when the app is running on background.

  private vibrateWatchNow(): void {
    console.log('GpsService :: vibrateWatchNow');
      window.setTimeout(() => {
        // stops vibration after 2 secs'GENERAL');
      }, 2000);
    } catch (err2) {
      console.log('GpsService :: vibrate failed :: err:', err2);

However, is not vibrating continuously for 2 secs.
Which “FeedbackPattern” should I use?


Would it not be simple enough to just generate a push message every five minutes using Tasker? I don’t know how (still learning how to use it) but that would be my approach.

The issue here is that you then get the “message” the app would be running on background ( after 5mins ) and you’d run “navigator.vibrate(2000);” and the watch would not vibrate.

Okay finally got this!

So, if anyone else wants to do it too:

  // You will need to add the following to your config.xml
  // <feature name=""/>
  // <tizen:privilege name=""/>
  public vibrateWatchFor(timeInMs: number): void {
    try {
      // Wakes up the watch so it vibrates
      tizen.power.request('SCREEN', 'SCREEN_NORMAL');
      tizen.power.request('CPU', 'CPU_AWAKE');
      // The returned "intervalID" is a numeric, non-zero value which identifies the timer created by the call to setInterval()
      // Source:
      let vibrateIntervalId = 0;
      // Schedule to stop vibration after the given param ('timeInMs')
      window.setTimeout(() => {
        if (vibrateIntervalId !== 0) {
      }, timeInMs);
      // Play the vibration pattern (VIBRATION_ON) every 100ms
      const vibrateIntervalInMs = 100;
      vibrateIntervalId = window.setInterval(() => {
        try {
        } catch (err3) {
          console.log('vibrateWatchFor :: play :: err3:', err3);
      }, vibrateIntervalInMs);
    } catch (err2) {
      console.log('vibrateWatchFor :: err2:', err2);

How to use - direct call (just like navigator.vibrate) [app is active]:


Vibrates after going to sleep / background:

// 90secs = 1m 30s [watch goes to sleep]
window.setTimeout(() => {
}, (90*1000));

This will vibrate the watch for 2secs even if the app is running on background.
It won’t vibrate like when the app is active, but at least it vibrates…

Cheers! :+1:

Thanks for sharing your progress. This is something I need in the near future and would have been lost without this example.

1 Like

No worries mate, was hoping that someone from SDP would help / give some advice on the subject.

PS: I have updated the details, have a look; all the best.

1 Like