欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

通过蓝牙调试(穿戴设备app) - 开发文档翻译

程序员文章站 2022-05-06 09:49:26
...

由于本人英文能力实在有限,不足之初敬请谅解

本博客只要没有注明“转”,那么均为原创,转贴请注明本博客链接链接

 

 

Debugging over Bluetooth

通过蓝牙调试

 

You can debug your wearable over Bluetooth by routing its debug output to the handheld device that's connected to your development machine.

你可以通过蓝牙debug你的穿戴设备,把穿戴设备的debug输出定向到连接在你的来发机器上的手持设备中。

 

Setup Devices for Debugging

debug设置

 

1.Enable USB debugging on the handheld:

a)Open the Settings app and scroll to the bottom.

b)If it doesn't have a Developer Options setting, tap About Phone (or About Tablet), scroll to the bottom, and tap the build number 7 times.

c)Go back and tap Developer Options.

d)Enable USB debugging.

打开手持设备中的USB调试

打开设置app病滚动到底部

如果它没有开发者选项,点击“关于手机” (或者关于平板),滚动到底部,然后点击版本号7次。

返回病点击开发者模式,开启USB调试。

 

2.Enable Bluetooth debugging on the wearable:

a)Tap the home screen twice to bring up the Wear menu.

b)Scroll to the bottom and tap Settings.

c)Scroll to the bottom. If there's no Developer Options item, tap About, and then tap the build number 7 times.

d)Tap the Developer Options item.

e)Enable Debug over Bluetooth.

开启手持设备的通过蓝牙调试

点击home两次进入Wear菜单。

滚动到底部并点击设置

滚动到底部。如果没有开发者选项,点击“关于”,然后点击版本号7次。

点击开发者模式,开启通过蓝牙调试。

 

 

Set Up a Debugging Session

设置debug会话

 

1.On the handheld, open the Android Wear companion app.

在手持设备中,打开Android Wear伴侣app

2.Tap the menu on the top right and select Settings.

点击右上角菜单选择设置

3.Enable Debugging over Bluetooth. You should see a tiny status summary appear under the option:

开启通过蓝牙debug。你应该会看见出现在这个选项下一个很小的状态描述。

Host: disconnected
Target: connected

4.Connect the handheld to your machine over USB and run:

通过USB连接手持设备并执行:

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

Note: You can use any available port that you have access to.

注意:你可以使用任何可用端口。

In the Android Wear companion app, you should see the status change to:

在Android Wear伴侣app中,你会看到状态变为:

Host: connected
Target: connected

 

 

Debug Your App

debug你的app

 

Your wearable should show up as localhost:4444 when running adb devices. To run any adb command, use this format:

当运行adb devices时,你的穿戴设备应该显示为localhost:4444。使用下面的格式执行adb命令:

adb -s localhost:4444 <command> 

If there are no other devices connected over TCP/IP (namely emulators), you can shorten the command to:

如果没有其他设备通过TCP/IP(即模拟器)连接,你可以简写命令为:

adb -e <command>

For example:

例如:

adb -e logcat
adb -e shell
adb -e bugreport

 

 

 

原文地址如下,英文水平实在有限,希望拍砖同时能给予指正。

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

 

转贴请保留以下链接

本人blog地址

http://su1216.iteye.com/

http://blog.csdn.net/su1216/