Android mode editor to support wear calendar classes


#1

Hi,

I am trying to create a watchface for android wear which graphically shows calendar events. For this to work I require Android mode supporting the android.support.wearable.provider classes.

It took a while for me to discover that the for android wear I actually require a slightly different class:

import android.support.wearable.provider.WearableCalendarContract;

and not the:

import android.support.wearable.provider.CalendarContract;


But the editor shows the “import cannot be resolved” error. So I tried to manually copy the wearable classes.jar file from the Android/Sdk/extras/google/m2repository/com/google/android/support/wearable/x.x.x/wearable-x.x.x.aar file into the code folder of my sketch, but that resulted in build errors. Deleting the jar file from the code folder results in successful build! So I was confused about the editor showing the error in the code.

Still i didn’t manage to get to the calendar events in android wear.

Q: Is there anyone who successfully used the android.support.wearable classes in their processing sketch willing to share his solution with me?

Thanks.


#2

From my limited exp in Processing Android, if you get the error highlighting in Android mode, I will ignore it at first. I will attempt to run the application and if it works, great! Unfortunately Android mode is not perfect and this bug has been there for a while.

I haven’t seen many posts here about wearable. I suggest you explore code from other sources and if you identify a code that you could use, you could share it here and the challenge would be to integrated with Processing. Then it becomes matter of try and error, some patient and perseverance. Starting with some existent code could make things a bit easier. Can you run a watch via emulator btw?

Kf


#3

@rudspring The Android mode does not include the wear dependencies, so this is why you get the error. At the moment, the only solution I can imagine is to manually download the corresponding packages (for the WearableCalendarContact class I think it is the Wearable Support Library), and copy them into your sketch. However, these are available as Android Archives (.aar) which Processing will not be able to import the required packages. You need to “explode” the aar (they are actually zip files, so you can unzip them to their contents) to extract the classes.jar, which contains the classes you need and Processing will be able to import into your sketch. Ideally, the Android mode should incorporate these jar files by default. Enhancement for a next release :slight_smile: