【发布时间】:2016-06-04 17:28:02
【问题描述】:
我目前正在开发一个 Android 应用程序,在我将手机的 Android 系统更新为适用于 Oneplus One 的 CyanogenMod 13 之前,一切正常。现在我的系统在我的应用程序应该收到BluetoothDevice.ACTION_FOUND Intent 之前不久崩溃了。
Manifest 中请求的权限:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
我也在运行时请求位置权限! 开始发现:
registerReceiver(discoveredDevice, new IntentFilter(BluetoothDevice.ACTION_FOUND));
btAdapter.startDiscovery()
然后在使用 Android Monitor 定位 com.android.bluetooth 一段时间后,我可以看到以下内容:(希望我复制了所有重要的内容)(我想收到的设备是 HTC Wildfire,以防万一你想知道)
06-04 19:04:15.961 30465-30582/com.android.bluetooth D/bt_osi_alarm: reschedule_root_alarm alarm expiration too close for posix timers, switching to guns
06-04 19:04:17.242 30465-30477/com.android.bluetooth I/art: Background sticky concurrent mark sweep GC freed 15038(3MB) AllocSpace objects, 275(5MB) LOS objects, 39% free, 15MB/25MB, paused 5.926ms total 27.652ms
06-04 19:04:17.641 30465-30586/com.android.bluetooth W/bt_btm: btm_process_inq_results: BDA: 90-21-55-9a-58-65
06-04 19:04:17.641 30465-30586/com.android.bluetooth W/bt_btm: btm_process_inq_results: Dev class: 5a-02-0c
06-04 19:04:17.645 30465-30575/com.android.bluetooth D/BluetoothRemoteDevices: Remote Address is:90:21:55:9A:58:65
06-04 19:04:17.645 30465-30575/com.android.bluetooth D/BluetoothRemoteDevices: Remote Device name is: HTC Wildfire
06-04 19:04:17.646 30465-30575/com.android.bluetooth D/BluetoothRemoteDevices: Remote class is:5898764
06-04 19:04:17.646 30465-30575/com.android.bluetooth D/BluetoothRemoteDevices: deviceFoundCallback: Remote Address is:90:21:55:9A:58:65
06-04 19:04:20.197 30465-30465/com.android.bluetooth D/HeadsetPhoneState: sendDeviceStateChanged. mService=1 mSignal=3 mRoam=0 mBatteryCharge=5
06-04 19:04:20.197 30465-30597/com.android.bluetooth D/HeadsetStateMachine: Disconnected process message: 11, size: 0
06-04 19:05:52.680 30465-30485/com.android.bluetooth D/BtGatt.GattService: Binder is dead - unregistering client (5)!
06-04 19:05:52.681 30465-30485/com.android.bluetooth W/BinderNative: Uncaught exception from death notification
java.lang.SecurityException: Need BLUETOOTH_ADMIN permission: Neither user 1002 nor current process has android.permission.BLUETOOTH_ADMIN.
at android.app.ContextImpl.enforce(ContextImpl.java:1450)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1482)
at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:681)
at com.android.bluetooth.gatt.GattService.enforceAdminPermission(GattService.java:2148)
at com.android.bluetooth.gatt.GattService.stopMultiAdvertising(GattService.java:1500)
at com.android.bluetooth.gatt.GattService$ClientDeathRecipient.binderDied(GattService.java:255)
at android.os.BinderProxy.sendDeathNotice(Binder.java:558)
注意抛出该错误的时间(大约一分半钟后)! 在那段时间手机被冻结,这意味着我只能关闭屏幕(甚至不能再次打开)或重新启动。如果我等那么久,手机会自动重启!
现在我的问题是这个问题是我的错还是 CyanogenMod 的错。 感谢您的帮助!
请参阅下面提出另一个问题的解决方案!
【问题讨论】:
-
机器人有 dmesg 日志吗?
-
我到底应该在 dmesg 日志中寻找什么?
-
蓝牙相关的东西
-
我找不到任何东西,但是我上传了两个日志:挂起状态 (drive.google.com/open?id=0B9yy3TGLUYoNUmppSHZyX1h2MVk) 和重启时 (drive.google.com/open?id=0B9yy3TGLUYoNc2dNejNzanpIU1U)
-
我终于设法在我兄弟的 OnePlus One 上测试了上述内容(与我不同的是,他仍在使用 Cyanogen OS),它就像一个魅力!因此,我假设 CyanogenMod 版本已损坏或在安装过程中出现问题。我现在要重新安装 CyanogenMod 并报告!