Languages

Menu
Sites
Language
is it possible to do real time data synchronization with companion app on android/ios?

i have an android fitness app on android and ios market, i want to create a tizen watch app. I need the following features, if possible can you please let me know

1) when i start the companion app on the phone, it should detect if there is a galaxy watch connected and ask user to if he wants to start the app on the phone.

2) there is a rest time between exercises, if user puts the app on the background, rest timer is displayed on notification bar as a continues updating notification.

my samsung galaxy active watch is displaying this also as notification on my screen but problem is it is not updating notification as android phone. Normally i sent every second a new notification to update timer. Is there a better or another way to display this on the watch?

3) i plan to create textbox and button on the watch where user can enter his repetitions and weight lifted, can this be real time data sync with phone. because it is during the workout and i need this to instantly updated on the phone app which will be also running.

thank you for your help. 

I appreciate.

Responses

2 Replies
Tizen .NET

Hi Emil Alipiev

You can communicate between phone and watch devices through BT. Real time data can be synchronized by exchaging data between devices via BT(Android : BT RFCOMM profile, iPhone: BLE GATT profile)
Samsung provides Samsung Accessory Protocol(SAP) API for data exchange.

  • SAP C# API Spec & Guide for Galaxy Watch App

   https://img-developer.samsung.com/onlinedocs/gear/Tizen_SAP/namespaceSamsung_1_1Sap.html
   https://developer.samsung.com/galaxy-watch/develop/creating-your-first-app/net-companion/setup-sdk
   https://developer.samsung.com/galaxy/accessory/guide
   https://developer.samsung.com/galaxy-watch/develop/samples/companion
   

  • Android Samsung Accessory SDK 2.6.1 API Reference

   https://img-developer.samsung.com/onlinedocs/sms/accessory/index.html
   https://developer.samsung.com/galaxy-watch/develop/tech-doc/how-to-use-samsung-accessory-sdk


But for iOS, SAP C# API is not available. Instead of SAP API, you can commnucate using BLE GATT API.
   https://developer.samsung.com/galaxy-watch/develop/tech-doc/gear-app-limitation-iphone
   https://developer.apple.com/bluetooth/
   https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/BestPracticesForInteractingWithARemotePeripheralDevice/BestPracticesForInteractingWithARemotePeripheralDevice.html#//apple_ref/doc/uid/TP40013257-CH6-SW1
   https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Introduction/Introduction.html
   https://developer.apple.com/library/archive/samplecode/BTLE_Transfer/Introduction/Intro.html

 

Regarding #1, please check "Provider(Gear) and Consumer(Android)" sample app in Hello Accessory Sample App page

To make Provider app(Galaxy Watch) launch, you need to modify accessoryservices.xml(HelloAccessory_.NET\HelloAccessory\Provider(Tizen)_Consumer(Android)\Provider\HelloAccessoryP\HelloAccessoryP.Tizen.Wearable\res\xml) file as follows:

         <serviceProfile id="/sample/hello"
                    name="HelloAccessoryProvider"
                    autoLaunchAppId="org.tizen.example.HelloAccessoryP.Tizen.Wearable"
                    role="provider" version="1.0">
 
When you press "CONNECT" button in Android's consumer app, the Provider app will be launched on the paried watch device.

About BT connection status, Tizen Bluetooth API provides the way to check it for the specified device and profile. Applications need to know UUID connecting to apps. UUID can be SAP Service UUID (A49EB41E-CB06-495C-9F4F-BB80A90CDF00) or your Custom UUID.
Anyway, you can check connection using Tizen Bluetooth API. First, you can get a list of bonded BT devices using BluetoodhAdapter.GetBondedDevices() and then find out a paired phone device among the bonded devices based on the following information:
  - IsConnected : true
  - AppearanceType : GenericPhone or Class.MajorDeviceClassType : Phone
  - GetConnectedProfiles : Android -Rfcomm, iOS - GenericAttribute
  - ServiceUuidList : SAP UUID (A49EB41E-CB06-495C-9F4F-BB80A90CDF00) or your Custom UUID

Using SAP Service UUID or your Custom UUID, you can exchange data between phone and watch.

In the opposite case, you can get information on the paired watch device through Android or iOS BT API.

Regarding Notification, ongoing notifications are not supported in Galaxy watch. You can use update() every second.

If you have any further questions, please feel free to ask. 

Thanks.

 

 

 

 

 

 

 

 

 

Emil Alipiev

thank you for detailed answer. I went through the sample and i have one question please. in my case, Phone needs to send a request to watch passing initial data and on the watch user will edit this data and send back to phone. In this case it is both way communication. But in the sample, either phone is provider or watch. in my case, roles of provider and consumer should be both. is it possible?