iOS Companion App

Former Member
Former Member
Hello,

I have a watch app that works well with its Android companion app.

Now, I'm trying to develop a companion app for iOS but I'm not able to get the watch app to communicate with the iOS counterpart. I'm starting from the documentation and the example that come with the iOS SDK found here: https://developer.garmin.com/downloads/connect-iq/sdks/connectiq-mobile-sdk-ios-1.3.zip

There are slight differences between what is stated in the documentation and what is available in the SDK itself (and implemented in the example). For instance, the signature of the IQApp constructor - in the docs it's given as:
IQApp *app = [IQApp appWithUUID:uuid device:device];
But in the SDK, and in the example, it is actually:
[IQApp appWithUUID:[[NSUUID alloc] initWithUUIDString:APP_ID] storeUuid:[[NSUUID alloc] initWithUUIDString:APP_ID_STORE] device:device];

Since my iOS companion app correctly finds the connected devices through Garmin Connect, but then fails to communicate with my watch app, I'm guessing the problem might be the way I instantiate the IQApp. It's simply not getting the messages sent from the watch app.

I use only the APP_ID which is defined in the manifest.xml of my watch app like this:
<iq:application entry="MyAppName" id="16B5C62BE4BD4F478F457A2F78B0EB95" launcherIcon="@Drawables.LauncherIcon" name="@Strings.AppName" type="watch-app">

And I don't know what to include as APP_ID_STORE, and if that parameter is crucial when establishing the watch app - companion app communication?

I tried to instantiate the IQApp as below, but still no success at establishing the communication:
[IQApp appWithUUID:[[NSUUID alloc] initWithUUIDString:APP_ID] storeUuid:[NSUUID UUID] device:device];

What else could be causing the problem?
  • Former Member
    Former Member over 8 years ago
    Is there a working example of a communication between a watch app and its iOS companion app?
  • Former Member
    Former Member over 8 years ago
    Is there a working example of a communication between a watch app and its iOS companion app?



    Has noone yet made an example of the communication between a watch app and an iOS companion app?
  • The ExampleApp included with the iOS Mobile SDK is designed to work with the Comm sample app included with the Connect IQ SDK. It's a pretty basic app that allows you to send strings between the Garmin device and the phone. I am not an iOS developer myself, so let me tag one of my team members to take a look at your comments and get you some help.
  • And I don't know what to include as APP_ID_STORE, and if that parameter is crucial when establishing the watch app - companion app communication?


    The APP_ID_STORE parameter is not critical for communication--in fact you can send Nil for this. The APP_ID you're using is also correct, matching the application ID in the manifest.
  • Former Member
    Former Member over 8 years ago
    The ExampleApp included with the iOS Mobile SDK is designed to work with the Comm sample app included with the Connect IQ SDK. It's a pretty basic app that allows you to send strings between the Garmin device and the phone. I am not an iOS developer myself, so let me tag one of my team members to take a look at your comments and get you some help.


    Thank you very much for the hint. I was aware of this, as that is the example I followed when I was creating the Android Companion app, but it was not functioning for me for iOS. It turns out, I was using a newer version of the SDK and an old version of the Comm example app. Once I imported the new example, from the 2.4 SDK, everything works fine. Now, I'm looking forward to making my app functional.

    Just one more question, my watch app was created with an older SDK as well (v.1.2 something), does it need an update in order to work with a companion app developed with the latest iOS SDK (1.3)?
  • Former Member
    Former Member over 8 years ago
    The solution

    I found the cause of the problem. It's a bit unexpected, so I'd like to share it with you.

    The problem was the APP_ID string formatting. If one uses just the plain string, as found in the manifest.xml of the Monkey-C project, it looks something like this: "a3421feed289106a538cb9547ab12095" - it works just fine in Android. But in iOS, one needs to format the string adding a few dashes, so that the string becomes "a3421fee-d289-106a-538c-b9547ab12095".

    Yes, without the dashes, the communication with the watchapp is not functioning.
  • I found the cause of the problem. It's a bit unexpected, so I'd like to share it with you.

    The problem was the APP_ID string formatting. If one uses just the plain string, as found in the manifest.xml of the Monkey-C project, it looks something like this: "a3421feed289106a538cb9547ab12095" - it works just fine in Android. But in iOS, one needs to format the string adding a few dashes, so that the string becomes "a3421fee-d289-106a-538c-b9547ab12095".

    Yes, without the dashes, the communication with the watchapp is not functioning.


    Thanks so much for reporting this. I've created a report to make sure that our documentation is updated or this is handled differently.

    Thanks again,

    -Coleman
  • Former Member
    Former Member over 8 years ago
    Opening the companion iOS app.

    I have other questions, and would be very grateful if someone could provide a bit of help.

    The documentation for Garmin's mobile SDK for iOS says:

    Unlike the Mobile SDK for Android, apps created with the Mobile SDK for iOS are standalone apps and do not directly rely on Garmin Connect Mobile (GCM) to communicate with a wearable device.


    And further:

    The iOS system allows apps that communicate with Bluetooth devices to be woken up to execute in the background when a connected device has data to send.


    My problem is that my watch app does not start the iOS companion app, unless it's already running (in the background). The companion app has a correctly setup URL scheme, and triggering such an URL in the browser does open the companion app. But, the wachapp does not open the companion app, unless it's already running in the background.

    Is this an expected limitation, or am I failing do implement the connection correctly?
  • Former Member
    Former Member over 4 years ago in reply to Former Member

    Thanks for reporting this. I came across this same issue 4 years later, as the docs still have not been updated.