when I use
connectIQ.registerForDeviceEvents(device, new IQDeviceEventListener() {
@Override public void onDeviceStatusChanged(IQDevice device, IQDeviceStatus newStatus) {
// Handle new status
} });
orconnectIQ.registerForAppEvents(device, app, new IQApplicationEventListener() {
@Override public void onMessageReceived(IQDevice device, IQApp app, List<Object> messageData, IQMessageStatus status) {
// First inspect the status to make sure this
// was a SUCCESS. If not then the status will indicate why there
// was an issue receiving the message from the Connect IQ application.
if (status == IQMessageStatus.SUCCESS) {
// Handle the message.
}
} });
app crashes when device status is changed or message is received with the following message:
Class not found when unmarshalling: com.garmin.android.connectiq.c
java.lang.ClassNotFoundException: com.garmin.android.connectiq.c
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2435)
at android.os.Parcel.readParcelable(Parcel.java:2389)
at android.os.Parcel.readValue(Parcel.java:2295)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2645)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:786)
at android.content.Intent.getParcelableExtra(Intent.java:5391)
at com.garmin.android.connectiq.IQMessageReceiver.onReceive(IQMessageReceiver.java:64)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:885)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.garmin.android.connectiq.c" on path: DexPathList[[zip file "/data/app/com.trinketworkshop.calllogwidget-1/base.apk"],nativeLibraryDirectories=[/data/app/com.trinketworkshop.calllogwidget-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel.readParcelableCreator(Parcel.java:2435)
at android.os.Parcel.readParcelable(Parcel.java:2389)
at android.os.Parcel.readValue(Parcel.java:2295)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2645)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:786)
at android.content.Intent.getParcelableExtra(Intent.java:5391)
at com.garmin.android.connectiq.IQMessageReceiver.onReceive(IQMessageReceiver.java:64)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:885)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: com.garmin.android.connectiq.c
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I have updated my companion apps with the latest connectiq-mobile-sdk-android-1.4/connectiq.jar but this didn't help.
Line number for IQMessageReceiver.onReceive is either 64 when message is received or 93 if status is changed.
Basically, current GCM killed most of the companion apps once again...
P.S. Tried GCM 3.18 and companion app doesn't crash on status change or message received, but I instantly started to get infamous "FAILURE_DURING_TRANSFER" when sending message to watch. Seems like GCM team didn't learn from their previous mistakes or Garmin just doesn't care about Android developers at all, which is a pity.
P.P.S. Basically, there is a workaround if I register my own receiver for the relevant status change broadcast and I was able to listen to that, but there's now workaround for the application messages as the payload is coded and hashed, according to IntelliJ-parsed classes from connectiq.jar, this requires unparceled application instance iterator, which is not available due to the unmarshalling problems.
This problem can easily be reproduces using the standard Comm example by sending data from watch to mobile companion.