Control phone volume from watch

hi, is there a way (API or something) to control the music volume of the phone from the watch? I want to create a watch face that allows me to change the phone volume from the watch more easily.

The watch already has a native music player that does that, but you have to navigate to the player, hit the speaker icon, and only then you can control the volume of the phone. I want to control it from the watchface itself, say by swiping up or down on it, so I don’t have to navigate to an app when I am driving or something. I already have that working on the watch with this:

    function handleTouchMove(evt) {
      if (!xDown || !yDown) {
        return;
      }

      var xUp = evt.touches[0].clientX;
      var yUp = evt.touches[0].clientY;

      var xDiff = xDown - xUp;
      var yDiff = yDown - yUp;
      var vol, strDay;
      
      if (Math.abs(xDiff) > Math.abs(yDiff)) {
        /*most significant*/
        if (xDiff > 0) {
          /* left swipe */
        } else {
          /* right swipe */
        }
      } else {
        if (yDiff > 0) {
          /* up swipe */
          vol = tizen.sound.getVolume("MEDIA");
          tizen.sound.setVolume("MEDIA", vol + 0.1);
        } else {
          /* down swipe */
          vol = tizen.sound.getVolume("MEDIA");
          tizen.sound.setVolume("MEDIA", vol - 0.1);
        }
      }
      /* reset values */
      xDown = null;
      yDown = null;
    }

But, as mentioned, the tizen.sound.setVolume function allows changing the volume but it only applies to the watch itself, not the phone it is connected to (at least in my tests). Perhaps it has to do with the Media Controller API? Sending some custom messages to a server or something like that? Just can’t find the way. I hope you can help me here.

Thanks,
Froilan

I believe you need to create a companion app on the watch and the controller on the phone.

I’ll move this to the Galaxy Watch forum for Native API which is for Tizen Developers if you are doing a web app you can move it there. They may be able to help you better. You can find companion examples HERE

Ron
Samsung Developer Program

Thanks for pointing it was on the wrong forum. I moved it to this, Tizen Web APIs, which is where it belongs I think. I updated the original post to include more information about the issue.

see THIS EXAMPLE

It shows how to interact with an App on the phone. You can control the camera from the watch you must be able to control the volume.

Ron
Samsung Developer Program

You need to write a simple application on your phone anyway. I see two ways:

  1. As said Ron you should use SAP API (Samsung Accessory Service). It is recommended and officially supported by Tizen APIs solution to control anything on host side.

or

  1. Alternative way. Simple solution but not documented and not recommended officially by Tizen documents. Follow this launch host app
    Look at Rodrigo Borba solution.

You can use Application control to launch your application on host (phone) and then do something. There is missing a way to pass some parameters to your app usually passed by intent on Android phone. You have to find it. Tip: the intuitive way is to add parameters after pakcage name like …&param1=sth&param2-sth and extract package launching arguments after start the Android app like C/C++ app does inside main() function but I’m not pretty sure about that.

From my experience a lot of developers use this way from time to time but you should track any changes in Tizen system and test your apps on new devices.

Hi, I followed Ron’s recommendation and have been studying the Accessory Protocol. After some serious work I was able to get the two apps talking to each other, and now I am able to send “commands” as made up text strings, like, “volup” or “voldown” which I use to actually control de volume on the host phone using android’s AudioManager. It’s working good so far, so now I am thinking of the actual graphic interface. The idea is to be able to control de music volume of the phone directly from the watch face as easy as posible, so you don’t even have to look.

My concern is now the user has to install the watch face AND the companion app on the phone, but andrzej_bugajny suggested reading, if I understood well, talks about a way to launch the app store and request application install from the watch. That’s pretty interesting in this scenario.

Something that’s made it particularly hard is that when I download the Accessory Programming Guid pdf from https://developer.samsung.com/galaxy-accessory/programming-guide.html the pdf is corrupted and wont open nor repair with any tool. I found and older version but have been using mostly the samples for learning. If anyone has the new guide pdf (2.6.0) I’d appreciate you share it.

Thank you guys for your kind help.

I think it is DRM locked. I see a few documents every year that don’t get unlocked when they are published. I’ve reported this to the documentation team and hopefully the can fix it quickly.

Ron
Samsung Developer Program

This issue was fixed and I and others were able to download it and open the file. Thanks for letting us know.

Ron
Samsung Developer Program