Sphero Android 示例应用未连接到机器人
Sphero Android sample apps not connecting to the robot
使用 Android Studio,推荐 IDE 用于 Sphero Android 开发,我正在尝试 运行 Sphero SDK 附带的示例应用程序。我可以让他们在我的设备 (Google Nexus 5) 上编译、安装和调试。但是,这些应用程序无法连接到 Sphero 2.0 机器人:
12-03 21:37:25.110 6070-6070/? I/art: Late-enabling -Xcheck:jni
12-03 21:37:25.158 6070-6070/com.orbotix.sensorstreaming W/ActivityThread: Application com.orbotix.sensorstreaming is waiting for the debugger on port 8100...
12-03 21:37:25.161 6070-6070/com.orbotix.sensorstreaming I/System.out: Sending WAIT chunk
12-03 21:37:25.177 6070-6077/com.orbotix.sensorstreaming I/art: Debugger is active
12-03 21:37:25.362 6070-6070/com.orbotix.sensorstreaming I/System.out: Debugger has connected
12-03 21:37:25.362 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:25.562 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:25.762 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:25.962 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.163 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.363 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.564 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.764 6070-6070/com.orbotix.sensorstreaming I/System.out: debugger has settled (1417)
12-03 21:37:26.853 6070-6070/com.orbotix.sensorstreaming W/System: ClassLoader referenced unknown path: /data/app/com.orbotix.sensorstreaming-2/lib/arm
12-03 21:37:26.921 6070-6070/com.orbotix.sensorstreaming W/obx-sdk: main :: Cannot start activity lifecycle monitor: Context used for discovery is not an activity.
12-03 21:37:26.922 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: BluetoothManager: android.bluetooth.BluetoothManager@72331d9
12-03 21:37:26.922 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: Bluetooth Adapter: android.bluetooth.BluetoothAdapter@a02879e
12-03 21:37:26.922 6070-6070/com.orbotix.sensorstreaming D/BluetoothManager: getConnectedDevices
12-03 21:37:26.926 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: Found 0 preconnected devices
12-03 21:37:26.926 6070-6070/com.orbotix.sensorstreaming D/obx-sdk: main :: Bluetooth 4.0 Discovery requested: 0 connected 0 visible
12-03 21:37:26.928 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:26.928 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: DiscoveryAgentClassic.startDiscovery()
12-03 21:37:26.929 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:26.937 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:26.948 6070-6163/com.orbotix.sensorstreaming D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-03 21:37:27.008 6070-6163/com.orbotix.sensorstreaming I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 09/02/15, 76f806e, Ibddc658e36
12-03 21:37:27.011 6070-6163/com.orbotix.sensorstreaming I/OpenGLRenderer: Initialized EGL, version 1.4
12-03 21:37:27.941 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:27.942 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:27.943 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:27.944 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:27.947 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:28.954 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:28.955 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:28.957 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:28.959 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:28.963 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:29.968 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:29.969 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:29.970 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:29.971 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:29.972 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:30.975 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:30.979 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:30.992 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:30.999 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:31.008 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:32.032 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:32.036 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:32.043 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:32.048 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:32.058 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:33.078 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:33.079 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:33.080 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:33.081 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:33.082 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:34.086 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:34.092 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:34.099 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:34.104 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:34.113 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:35.133 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:35.133 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:35.135 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:35.135 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:35.138 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:36.141 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:36.145 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:36.153 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:36.157 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:36.167 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:37.190 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:37.194 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:37.209 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:37.213 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:37.240 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:38.252 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:38.255 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:38.268 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:38.271 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:38.281 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:39.307 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:39.308 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:39.311 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:39.312 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:39.315 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:39.783 6070-6070/com.orbotix.sensorstreaming W/obx-sdk: main :: Discovery finished, restarting as nothing was found
12-03 21:37:40.327 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:40.328 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:40.329 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:40.330 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:40.331 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:41.334 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:41.338 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:41.345 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:41.357 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:41.372 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:42.377 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:42.382 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:42.389 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:42.394 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:42.404 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:43.428 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:43.432 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:43.439 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:43.443 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:43.453 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:44.475 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:44.477 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:44.481 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:44.483 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:44.489 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:44.944 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: Interrupted discovery runnable
12-03 21:37:44.944 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: DiscoveryAgentClassic.stopDiscovery()
12-03 21:37:45.007 6070-6163/com.orbotix.sensorstreaming E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9426de0
12-03 21:37:45.499 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:45.501 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:45.502 6070-6161/com.orbotix.sensorstreaming V/obx-sdk: Thread-5051 :: Discovery runnable no longer running
该应用确实在清单中预先设置了适当的权限:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
我已将 phone 与机器人配对,官方 Sphero 应用程序会立即连接。我错过了什么?
编辑:我现在已经尝试了 Android Studio 和 Unity 的示例应用程序,但都无法连接。官方应用程序继续正常运行。我希望 Orbotix 会发布 那个 代码。
Sphero Android 开发者在这里。
由于这些示例的目标是 API 22(至少现在是这样。我的待办事项列表中有更新到 23 并添加权限支持示例),您无需担心请求运行时的权限。但是,由于您使用的是 Nexus 5,我猜您使用的是 Marshmallow。使用最新的 Android OS,扫描和连接蓝牙需要位置权限。尝试将以下行添加到您在 AndroidManifest.xml
中的权限
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
此外,您还需要确保您的设备级别定位服务已启用。
使用 Android Studio,推荐 IDE 用于 Sphero Android 开发,我正在尝试 运行 Sphero SDK 附带的示例应用程序。我可以让他们在我的设备 (Google Nexus 5) 上编译、安装和调试。但是,这些应用程序无法连接到 Sphero 2.0 机器人:
12-03 21:37:25.110 6070-6070/? I/art: Late-enabling -Xcheck:jni
12-03 21:37:25.158 6070-6070/com.orbotix.sensorstreaming W/ActivityThread: Application com.orbotix.sensorstreaming is waiting for the debugger on port 8100...
12-03 21:37:25.161 6070-6070/com.orbotix.sensorstreaming I/System.out: Sending WAIT chunk
12-03 21:37:25.177 6070-6077/com.orbotix.sensorstreaming I/art: Debugger is active
12-03 21:37:25.362 6070-6070/com.orbotix.sensorstreaming I/System.out: Debugger has connected
12-03 21:37:25.362 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:25.562 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:25.762 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:25.962 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.163 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.363 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.564 6070-6070/com.orbotix.sensorstreaming I/System.out: waiting for debugger to settle...
12-03 21:37:26.764 6070-6070/com.orbotix.sensorstreaming I/System.out: debugger has settled (1417)
12-03 21:37:26.853 6070-6070/com.orbotix.sensorstreaming W/System: ClassLoader referenced unknown path: /data/app/com.orbotix.sensorstreaming-2/lib/arm
12-03 21:37:26.921 6070-6070/com.orbotix.sensorstreaming W/obx-sdk: main :: Cannot start activity lifecycle monitor: Context used for discovery is not an activity.
12-03 21:37:26.922 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: BluetoothManager: android.bluetooth.BluetoothManager@72331d9
12-03 21:37:26.922 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: Bluetooth Adapter: android.bluetooth.BluetoothAdapter@a02879e
12-03 21:37:26.922 6070-6070/com.orbotix.sensorstreaming D/BluetoothManager: getConnectedDevices
12-03 21:37:26.926 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: Found 0 preconnected devices
12-03 21:37:26.926 6070-6070/com.orbotix.sensorstreaming D/obx-sdk: main :: Bluetooth 4.0 Discovery requested: 0 connected 0 visible
12-03 21:37:26.928 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:26.928 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: DiscoveryAgentClassic.startDiscovery()
12-03 21:37:26.929 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:26.937 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:26.948 6070-6163/com.orbotix.sensorstreaming D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-03 21:37:27.008 6070-6163/com.orbotix.sensorstreaming I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 09/02/15, 76f806e, Ibddc658e36
12-03 21:37:27.011 6070-6163/com.orbotix.sensorstreaming I/OpenGLRenderer: Initialized EGL, version 1.4
12-03 21:37:27.941 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:27.942 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:27.943 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:27.944 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:27.947 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:28.954 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:28.955 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:28.957 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:28.959 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:28.963 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:29.968 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:29.969 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:29.970 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:29.971 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:29.972 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:30.975 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:30.979 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:30.992 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:30.999 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:31.008 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:32.032 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:32.036 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:32.043 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:32.048 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:32.058 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:33.078 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:33.079 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:33.080 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:33.081 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:33.082 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:34.086 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:34.092 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:34.099 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:34.104 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:34.113 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:35.133 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:35.133 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:35.135 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:35.135 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:35.138 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:36.141 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:36.145 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:36.153 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:36.157 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:36.167 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:37.190 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:37.194 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:37.209 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:37.213 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:37.240 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:38.252 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:38.255 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:38.268 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:38.271 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:38.281 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:39.307 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:39.308 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:39.311 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:39.312 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:39.315 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:39.783 6070-6070/com.orbotix.sensorstreaming W/obx-sdk: main :: Discovery finished, restarting as nothing was found
12-03 21:37:40.327 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:40.328 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:40.329 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:40.330 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:40.331 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:41.334 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:41.338 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:41.345 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:41.357 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:41.372 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:42.377 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:42.382 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:42.389 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:42.394 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:42.404 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:43.428 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:43.432 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:43.439 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:43.443 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:43.453 6070-6082/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:44.475 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:44.477 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:44.481 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: startLeScan(): null
12-03 21:37:44.483 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:44.489 6070-6083/com.orbotix.sensorstreaming D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
12-03 21:37:44.944 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: Interrupted discovery runnable
12-03 21:37:44.944 6070-6070/com.orbotix.sensorstreaming V/obx-sdk: main :: DiscoveryAgentClassic.stopDiscovery()
12-03 21:37:45.007 6070-6163/com.orbotix.sensorstreaming E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa9426de0
12-03 21:37:45.499 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: stopLeScan()
12-03 21:37:45.501 6070-6161/com.orbotix.sensorstreaming D/BluetoothAdapter: STATE_ON
12-03 21:37:45.502 6070-6161/com.orbotix.sensorstreaming V/obx-sdk: Thread-5051 :: Discovery runnable no longer running
该应用确实在清单中预先设置了适当的权限:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
我已将 phone 与机器人配对,官方 Sphero 应用程序会立即连接。我错过了什么?
编辑:我现在已经尝试了 Android Studio 和 Unity 的示例应用程序,但都无法连接。官方应用程序继续正常运行。我希望 Orbotix 会发布 那个 代码。
Sphero Android 开发者在这里。
由于这些示例的目标是 API 22(至少现在是这样。我的待办事项列表中有更新到 23 并添加权限支持示例),您无需担心请求运行时的权限。但是,由于您使用的是 Nexus 5,我猜您使用的是 Marshmallow。使用最新的 Android OS,扫描和连接蓝牙需要位置权限。尝试将以下行添加到您在 AndroidManifest.xml
中的权限<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
此外,您还需要确保您的设备级别定位服务已启用。