B4A Library Wearable DataLayer BETA

First thing first, this is an early Beta for those that wish to start playing with Android Wear. There are things that don't work yet or haven't been fully tested yet (Assets, deleting DataMaps, etc).

Relevant threads:
Tutorial to create a Wear AVD - for if you don't have a device
Tutorial for Creating and Packaging a Wear app - required for the Wear app to install on the Wear Device.

What's included in this thread:
  • The DataLayer Library Beta - this library is what is required for communications between your Handheld and the Wearable
  • Example projects - there are 2 projects, one is the Wearable app and the other is the HandHeld app. The Handheld already has the apk for the Wearable packaged inside so it is ready to go. Compile and install the Handheld project and both parts will install. I've had to upload Handheld project to DropBox for now as it is too big for the forum limits Download Here
In my example apps the handheld has 2 sections. Profile details:- this adds a string (name) and an Int (age) to a DataMap and syncs it, the profile image will be effective once I get Assets up and running. Then there is the message section that sends a one way message.

On Wearable the DataMap is sync'd and the info displayed on an activity and the the messages are shown as Toasts.

First important edit that I felt I had to find 5 minutes to add
The use of this library requires the inclusion of Google Play Services. Similar to the Android-Support libraries, you have to download this with sdk manager and copy the library files over to your additional libraries folder. A typical place for this would be

C:\Program Files\Android\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs

Although this path may vary dependent on your installation.

It also requires 'AdditionalRes' (see the attributes in the activity module). Again the path may vary. This is just for the Version ID of Play Services.


I will spruce this post up a bit more when I get time.
 

Attachments

  • Wearable.zip
    8.1 KB · Views: 420
  • WearableDataLayerLibFiles.zip
    24.7 KB · Views: 378
Last edited:

Ph1lJ

Member
Licensed User
Longtime User
Ok, so after some investigation I discovered I needed to add that *.jar file to my Addlib folder, did that but it know seems to be compiling but never finishes ?

Any help would be appreciiated - My Pc is running 64-bit OS
 

Uitenhage

Member
Licensed User
Longtime User
Ok, so after some investigation I discovered I needed to add that *.jar file to my Addlib folder, did that but it know seems to be compiling but never finishes ?

Any help would be appreciiated - My Pc is running 64-bit OS

I had a few early compiles run under Debug (legacy) but as the app got more complex it also wouldn't finish. I wind up with a lot of ToastMessageShows to let me know what is happening. I'm on a 64-bit machine with 4GB of memory.
 

Ph1lJ

Member
Licensed User
Longtime User
I had a few early compiles run under Debug (legacy) but as the app got more complex it also wouldn't finish. I wind up with a lot of ToastMessageShows to let me know what is happening. I'm on a 64-bit machine with 4GB of memory.
Yeah - the issue appears to be associated with
Convert byte code - optimized dex. Error

regardless of how I compile it
 

Uitenhage

Member
Licensed User
Longtime User
I sometimes get them timing out and occasionally some 'classes' folder gets an access denied. I immediately retry the compile and more often than not it works. I suspect it's the nature of the beta version of the DataLayer library as I have much larger apps with a bunch of libraries referenced that don't have these issues.
 

barx

Well-Known Member
Licensed User
Longtime User
These aren't issues to do with the Beta status. the only reason the Beta status still stands is because I haven't got the Assets working fully yet. I too get the access denied from time to time. I'm assuming it's a small bug in B4A but never really investigated it as a second compile attempt always works. As for the other issue. The fact that the library requires the android-support-v4 adds a lot to the project. and thus it increases the compile time dramatically. this sometimes times out. I believe that there is a way to increase the time out but it's not something I have carried out myself.
 

Ph1lJ

Member
Licensed User
Longtime User
Well I lengthened the compile time to 60sec and now I get this
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.Arrays.copyOfRange(Arrays.java:2694)
at java.lang.String.<init>(String.java:203)
at java.lang.String.substring(String.java:1877)
at com.android.dx.rop.type.Prototype.intern(Prototype.java:100)
at com.android.dx.rop.cst.CstBaseMethodRef.<init>(CstBaseMethodRef.java:50)
at com.android.dx.rop.cst.CstMethodRef.<init>(CstMethodRef.java:31)
at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:310)
at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)
at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
Optimized dexer failed. Switching to Standard dexer.

So where do I go from here, this has never been a problem before, I've complied many apps for teaching purposes
 

smishra

Member
Licensed User
Longtime User
I would like to transfer a file from the android wear device to the phone. I guess one needs the assets part of the library to work for that to happen

Any other easy way to programmatically transfer the files?

I am currently using the FileManager Wear app for doing this. It is clunky and buggy.
 

barx

Well-Known Member
Licensed User
Longtime User
I would like to transfer a file from the android wear device to the phone. I guess one needs the assets part of the library to work for that to happen

Any other easy way to programmatically transfer the files?

I am currently using the FileManager Wear app for doing this. It is clunky and buggy.
How big is the file?
 

smishra

Member
Licensed User
Longtime User
The file to be transferred is fairly large 6-24 MB.

Thanks for all your help Barx. I sent you a little something via the Donate button in appreciation.:)
 

barx

Well-Known Member
Licensed User
Longtime User
The file to be transferred is fairly large 6-24 MB.

Thanks for all your help Barx. I sent you a little something via the Donate button in appreciation.:)
That will definitely need Assets. I will try to get them working ASAP for you. I haven't done any work with files and streams, etc tbh which is half the issue, knowing how to handle it as it is fetched from the Asset.

I believe it is returned in java as a File Descriptor. So I need to figure what to do with that, lol.

p.s. thank you very much for the donation. It is very much appreciated ;)
 

jhd

Member
Licensed User
Longtime User
Hi!

I m looking for a sample of watchface using your datalayer and official watchace api? Maybe you have it?
 

barx

Well-Known Member
Licensed User
Longtime User
Hey guys and gals,

It's been a while since any updates and I can only apologize for that. Had a few personal issues going on including my old man (dad) is literally on deaths door so my head hasn't been straight. I had a little coding session at the weekend I am happy to say everything now seems to be working. That includes sending bitmaps and Files as Assets across the Wear network.

I need to finish off a couple of bits of documentation and do a little more testing. Unfortunately I won't get time to do this now until the weekend. I hope to release a final version at some point over the weekend.

Thanks
 

mickeyk600

Member
Licensed User
Longtime User
Hi , I need help


I have been using/testing this Library and was able to install and move information from the Handheld to the wearable – so far so good. (thanks)

Trying to access the Accelerometer by using the event Accel_AccelerometerChanged, I am getting nothing at all.

Was anyone able to access the Accelerometer using this LIB?

I have added the “phone” Library to the Wearable project – still no go

Do I need to add a Permission? Do I miss anything else?

1/12/2005
--->>>>> Got it now , it works perfect
 
Last edited:

smishra

Member
Licensed User
Longtime User
Hey guys and gals,

It's been a while since any updates and I can only apologize for that. Had a few personal issues going on including my old man (dad) is literally on deaths door so my head hasn't been straight. I had a little coding session at the weekend I am happy to say everything now seems to be working. That includes sending bitmaps and Files as Assets across the Wear network.

I need to finish off a couple of bits of documentation and do a little more testing. Unfortunately I won't get time to do this now until the weekend. I hope to release a final version at some point over the weekend.

Thanks

Thanks Barx for working on this during these difficult times.

May you have the strength to handle everything.
 

Theera

Well-Known Member
Licensed User
Longtime User
Just updated the library files in the OP. Added a few more features, can now get DataMaps from the Wear Network at anytime:
.GetDataMap for singular
.GetAllDataMaps for all

You can now also delete a DataMap from the Wear Network.

Most things are working now. LocalNodeID will complain about being run in the UI thread as I was trying to do this without the use of a callback event. Looks like I need to do a Callback event for it. I class the library as close to finished now. couple more fixes and the just need to master the Static listenerService for apps to receive data whilst the app is closed.

Note: Some methods / Event signatures may have changed. To be honest I have messed with it that much I cannot remember, lol

I will update the demo apps later.

To be continued...

Where is the OP?
 

barx

Well-Known Member
Licensed User
Longtime User
Where is the OP?
OP = original post. I.e. post number 1 of this thread. Ignore that now though as the library has had its first v1 release. Search for wearable datalayer ;)
 
Top