Android Mobile SDK - tethered connection - app status UNKNOWN

Hi!

I'm trying to communicate from my Garmin app to the Android app via Mobile SDK using tethered connection. My setup is the following:

- CIQ simulator connected to adb port forward (adb forward tcp:7381 tcp:7381)

- Android app is started in a simulator

In the Android app I have:

try {
connectIQ.registerForDeviceEvents(device) { _, status ->
Log.i(TAG, "Device ${device} status ${status.name}")
}
} catch (e: InvalidStateException) {
Log.wtf(TAG, "InvalidStateException: We should not be here!", e)
}

and it results in the following in the logs:

Device Simulator status CONNECTED

But when I try to:

myApp = IQApp(COMM_WATCH_ID)
try {
connectIQ.getApplicationInfo(COMM_WATCH_ID, device, object :
ConnectIQ.IQApplicationInfoListener {
override fun onApplicationInfoReceived(app: IQApp) {
Log.i(
TAG,
"App info: ID='${app.applicationId}' displayName='${app.displayName}' status='${app.status}'"
)
}

override fun onApplicationNotInstalled(applicationId: String) {
Log.i(TAG, "Application not installed ID='${applicationId}'")
}
})
} catch (e: Exception) {
Log.e(TAG, "Cannot get app info", e)
}

it always reports application status UNKNOWN:

MainActivity com.myapp.android  I  App info: ID='EEE4296AC77F44F09DCAF055D802A894' displayName='' status='UNKNOWN'

Also when I try this:

        try {
connectIQ.registerForAppEvents(device, myApp) { _, _, messages, status ->
Log.i(TAG, "Got ${messages.size} messages with status ${status.name}")
}
} catch (e: InvalidStateException) {
Log.e(TAG, "ConnectIQ is not in a valid state", e)
}

and I transmit some data from my Garmin app:

function publishToPhone() {
    $.Toybox.Communications.transmit("Hi", null, new PhoneCommunicationConnectionListener());
}
class PhoneCommunicationConnectionListener extends Communications.ConnectionListener {
    function initialize() {
        Communications.ConnectionListener.initialize();

    }
    function onComplete() {
        System.println("Transmit Complete");
    }
    function onError() {
        System.println("Transmit Failed");
    }
}

I can see only the following in the logs:

ICQ Simulator:

Transmit Complete

Android logcat:

ConnectIQ-AdbConnection com.myapp.android  D  Received 26 from simulator
ConnectIQ-AdbConnection com.myapp.android  D  Looking for input from simulator

but my listener in the Android app is never invoked (Log.i(TAG, "Got ${messages.size} messages with status ${status.name}") is never triggered).

I double checked the app UUID and it is identical in both Garmin app and Android app.

What am I doing wrong?

implementation("com.garmin.connectiq:ciq-companion-app-sdk:2.0.3@aar")

connectiq-sdk-mac-7.2.1-2024-06-25-7463284e6

Best regards,

Piotr

  • The same. Did you get any answer/fix? Only in my case: it's 25 received.

    Device events are coming in the following function, which is a device listener, but nothing is coming through AppEvents (and this is where data should be coming from)

    mConnectIQ!!.registerForDeviceEvents(device, mDeviceEventListener) <---- THIS WORKS (see the listener below)
    ...
    private val mDeviceEventListener = IQDeviceEventListener { device, status ->
       App.d(TAG, "garmin status " + status) //  <--------- THIS WORKS and I'm getting CONNECT status
    }
    mConnectIQ!!.registerForAppEvents(device, mGarminApp) { dev, app, message, status ->
         ... THIS ONE IS NEVER CALLED AND DOESN'T WORK
    }

    ===== In Logcat I see this ====

    Received 25 from simulator
    2024-09-02 15:16:31.743 3261-3302 ConnectIQ-AdbConnection info.gryb.gacw D Looking for input from simulator.
    2024-09-02 15:16:38.675 3261-3302 ConnectIQ-AdbConnection info.gryb.gacw D Received 25 from simulator
    2024-09-02 15:16:38.691 3261-3302 ConnectIQ-AdbConnection info.gryb.gacw D Looking for input from simulator.
    2024-09-02 15:16:48.212 3261-3302 ConnectIQ-AdbConnection info.gryb.gacw D Received 25 from simulator

  • - please take a look. It's probably related to the recent BLUETOOTH permission model changes in API Level 34+, IDK, but events are still coming, we just can't get data

  • Re: appStatus UNKNOWN, if I get it correctly, it's just like that "by implementation"/limitation of SDK (for the tethered connection). In cases like this you can take a look at decompiled version of the SDK, particularly ConnectIQAdbStrategy:

    It's just invokes the callback immediately, with newly created IQApp, that is initalized with UNKNOWN status by default.

  • I have this exact same problem for months now. However, the connection works flawlessly without the simulator (vivoactive 3 and IQConnectType set to WIRELESS).

    I've been using an old version (1.5) of the mobile connect iq SDK that I had in an older environment to continue development in my current project. The problem is that it appears to be incompatible with the latest Connect IQ SDK (version 7.3.0 for example).
    Don't hesitate to reach me out if you have any questions that could help solve this issue as it's basically impossible to debug my project right now.

  • I found the problem and made simulator working with ADB. The bug is in Garmin Simulator: it sends an empty applicationId instead of the registered ID. I found it by debugging the SDK.

    Since nothing is registered for the empty application ID mobile SDK discards the messages and the Android app gets nothing. You need to register application event listener for an app with empty ID to receive messages from the Garmin Simulator:

    mConnectIQ!!.registerForAppEvents(deviceIQApp("")devappmessagestatus ->
         ... message processing code is here ..
    } 

    For real Garmin devices the code should be the same as before. I hope Garmin will fix the bug soon.

  • I tried this fix this mourning and it worked for me, thank you!

    I hope it will get fixed by Garmin soon

  • Your workaround is working - thank you so much!