Examples
Each app that is made for Android Wear essentially contains 2 apps. One for the Wearable and one for the Mobile. the examples will come with both apps and the wearable pre-embedded in the mobile app.
Unfortunately it appears the examples will be too large to upload here so for now I will add them to my DropBox account and post links. If anybody knows a better solution........
Example 1: Simple messages with static listener
Very simple example show one way messages from mobile to wearable. the wearable uses a static listener so messages are received even if the app is closed. This example simply creates a ToastMessageShow() to show the message.
Download Link
Example 2: Simple messages with dynamic listener
Similar to example 1 but this one uses dynamic listener. This means that the messages will only be received on the wearable when the app is active. For anyone that doesn't know yet, to start an app: tap the screen, scroll down to bottom and pat 'Start', find the app and tap it to launch...
Download Link
Tried the Dynamic listener, Soon as the app starts on the tablet I get this twice:
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 338)
java.lang.NoClassDefFoundError: android.support.v4.util.ArrayMap
at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
at barxdroid.wearabledatalayer.WearableDataLayer.Initialize(WearableDataLayer.java:77)
at barxdroid.wearable.example.dynamicmessage.main._activity_create(main.java:338)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at barxdroid.wearable.example.dynamicmessage.main.afterFirstLayout(main.java:102)
at barxdroid.wearable.example.dynamicmessage.main.access$000(main.java:17)
at barxdroid.wearable.example.dynamicmessage.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
main_activity_create (java line: 338)
java.lang.NoClassDefFoundError: android.support.v4.util.ArrayMap
at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
at barxdroid.wearabledatalayer.WearableDataLayer.Initialize(WearableDataLayer.java:77)
at barxdroid.wearable.example.dynamicmessage.main._activity_create(main.java:338)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at barxdroid.wearable.example.dynamicmessage.main.afterFirstLayout(main.java:102)
at barxdroid.wearable.example.dynamicmessage.main.access$000(main.java:17)
at barxdroid.wearable.example.dynamicmessage.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 338)
java.lang.NoClassDefFoundError: android.support.v4.util.ArrayMap
at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
at barxdroid.wearabledatalayer.WearableDataLayer.Initialize(WearableDataLayer.java:77)
at barxdroid.wearable.example.dynamicmessage.main._activity_create(main.java:338)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at barxdroid.wearable.example.dynamicmessage.main.afterFirstLayout(main.java:102)
at barxdroid.wearable.example.dynamicmessage.main.access$000(main.java:17)
at barxdroid.wearable.example.dynamicmessage.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
main_activity_create (java line: 338)
java.lang.NoClassDefFoundError: android.support.v4.util.ArrayMap
at com.google.android.gms.common.api.GoogleApiClient$Builder.<init>(Unknown Source)
at barxdroid.wearabledatalayer.WearableDataLayer.Initialize(WearableDataLayer.java:77)
at barxdroid.wearable.example.dynamicmessage.main._activity_create(main.java:338)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at barxdroid.wearable.example.dynamicmessage.main.afterFirstLayout(main.java:102)
at barxdroid.wearable.example.dynamicmessage.main.access$000(main.java:17)
at barxdroid.wearable.example.dynamicmessage.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)