Friday, 6 October 2017

create an android watch face on Android Studio

1. you can install your developing watch face app into a emulator and real devices as well.

2. deploying to a emulator is much easier, however, if your pc and android studio has everything already, that is peace of cake.



3. if you want to run your watch app, you should do this change:


4. to install your app into emulator, you can do you what you do with mobile app:



Deploy to your real watch:


On other posts people mention that to install your watch app, you can install the mobile app into your phone and the watch  part will be installed into your watch automatically.

To do this, you should install the "release" app (debug is not ok) . and release app should "sign".

However, that is not true. As a developer, to install your code into your watch you should:

1, open the setting page on your watch.
2, go to about page.
3, tap build number 7 times, then it will open the developer model. (as you do on your phone)
4, back to settings page and open "develop " page.
5, "enable" your "Debug over Bluetooth" and "ADB debugging".

6, go to your phone and open the wear app on your phone.
7. click setting button on the right top corner.
8, turn on "debug over bluetooth"
9,  then you should be able to see this:

Host: disconnectedTarget: connected

10, then you should run below script on your shell to connect host: (to run this you should make sure you only have phone connects to your pc and close all emulators)

adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444

11, then you should be about to see this:
Host: connectedTarget: connected
12, then run your app agin, you should be able to see your watch:


13, then you can deploy your watch app to your watch.




https://developer.android.com/intl/zh-cn/training/wearables/apps/bt-debugging.html

https://developer.android.com/intl/zh-cn/training/wearables/apps/creating.html

0 comments: