Android Question Creating a Wear App

barx

Well-Known Member
Licensed User
Longtime User
Ok, The mission isn't going too well.

Ran out of ideas all ready. This is pretty much all the documentation we have as creating Wear apps is still very new and so no examples / tutorials out there.

https://developer.android.com/training/wearables/apps/packaging.html

So here is what I have done so far. Just a quick note, I'm not sure if this is an issue with the IDE compressing assets (See the bottom of the above page).

I created a very simple project with just a label and edit text on an activity. I have installed this directly on a Wear AVD through adb. Project attached as 'wearable_app.zip'.

I then create another simple project, this will be the phone-side app. I copy the wearable_app.apk to phone-side project \res\raw and make it read only.

I created a new file - phone-side project \res\wearable_app_desc.xml and added the following

B4X:
<wearableApp package="barxdroid.wearable_app">
    <versionCode>1</versionCode>
    <versionName>1.0</versionName>
    <rawPathResId>wearable_app</rawPathResId>
</wearableApp>

I then added the following to phone-side project manifest editor

B4X:
AddApplicationText(
<meta-data android:name="barxdroid.wearable_app"
    android:resource="@xml/wearable_app_desc"/>
)

This project is also attached as wearable_test.zip

OK, that's it. I install. It goes fine on phone, no errors or anything but nothing on the Wear watch.

I have tried different variants of package names in the xml and manifest, etc. and also cleaned the project.

I think this may be one for @Erel but as always anyone can join in. I am wiling to try anything.

Going to sleep on this now and have another couple of hours in the morning.

Thanks all...
 

Attachments

  • wearable_app.zip
    6 KB · Views: 288
  • wearable_test.zip
    109.9 KB · Views: 313
Last edited:

barx

Well-Known Member
Licensed User
Longtime User
@Erel does the Basic4Android IDE compress Assets?

If it does, is there a way to turn this off. The android docs above state that many Build Tools do indeed compress Assets and that this will cause issues.

Thanks
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
OK, I can confirm I got it working...

That's right, Basic4Android CAN build apps for Wearables.

Unfortunately for you guys I'm not going to do a tutorial just yet as I want to get the Data Layer library sorted first so that the 2 can talk to each other.

The excitement felt when I installed the app on the phone and it appeared on the watch too was rather satisfying.

Here are a couple of screenshots just for proof of concept. The first screen is the 'Start' menu item which is used to launch all Wear apps. The second is the app. Just something simple, a label that has the text 'Wearable' on it and an edittext.

App list.png
App main.png


More to come soon guys...
 
Last edited:
Upvote 0

smishra

Member
Licensed User
Longtime User
Thanks Barx! Inspired by you I am investing in a Samsung Gear Live :)

Will report progress once I have made some.
 
Upvote 0

smishra

Member
Licensed User
Longtime User
Progress!
Normal B4A apps work on Samsung Gear Live. I was able to compile and download one of my apps to the Samsung Gear Live watch using the normal Release procedure. However till we get the watch talking to the paired phone most apps will be crippled.

The watch was connected to the development machine over USB cable as described in
https://developer.android.com/training/wearables/apps/creating.html

Prior to this I had to ensure that the watch talked to my PC using
http://stackoverflow.com/questions/24583354/adb-doesnt-recognize-samsung-gear-live-or-lg-g-watch

http://www.androidpolice.com/2014/0...nlock-the-bootloader-and-root-the-lg-g-watch/
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Progress!
Normal B4A apps work on Samsung Gear Live. I was able to compile and download one of my apps to the Samsung Gear Live watch using the normal Release procedure. However till we get the watch talking to the paired phone most apps will be crippled.

The watch was connected to the development machine over USB cable as described in
https://developer.android.com/training/wearables/apps/creating.html

Prior to this I had to ensure that the watch talked to my PC using
http://stackoverflow.com/questions/24583354/adb-doesnt-recognize-samsung-gear-live-or-lg-g-watch

http://www.androidpolice.com/2014/0...nlock-the-bootloader-and-root-the-lg-g-watch/
I explained this here too ;)

http://www.b4x.com/android/forum/threads/the-next-step-on-wearables.43887/#post-269135
 
Upvote 0

MLDev

Active Member
Licensed User
Longtime User
Thank you Barx! I've been playing with watch faces and I'm now working on a game for my watch. I'm using Android Studio and I was wondering if I could get it to work with B4A. Then I saw your post. Later today I'll see if I can get it to work.

Thanks again!

Mike
 
Upvote 0
Top