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

  • thank you Grigorii for confirmation!

    Seems i was in a hurry and just missed the Event registration i was looking for before expecting it to happen.

    Background: 08:21:03 1 NotificationsApp::onStart
    Background: 08:21:03 2 NotificationsApp::onStart register For Temporal Event
    Background: 08:21:03 3 NotificationsApp::onStart register For Phone App Message Event
    08:21:04 1 NotificationsApp::onStart
    08:21:04 2 NotificationsApp::onStart register For Temporal Event
    08:21:04 3 NotificationsApp::onStart register For Phone App Message Event
    08:21:04 4 NotificationsView::onUpdate
    08:21:04 5 NotificationsView::onUpdate
    Background: 08:21:34 1 NotificationsApp::onStart
    Background: 08:21:34 2 NotificationsApp::onStart register For Temporal Event
    Background: 08:21:34 3 NotificationsApp::onStart register For Phone App Message Event
    Background: 08:21:34 4 BackgroundDelegate::onPhoneAppMessage
    Background: 08:21:34 5 BackgroundDelegate::onPhoneAppMessage: {Thanks=>Grigorii}