簡體   English   中英

藍牙 LE 不掃描設備

[英]Bluetooth LE not scanning for devices

我一直在構建一個android應用程序。 我使用我的galaxy s4 和galaxy not 10 進行調試。 當我使用 Galaxy s4 時,我能夠掃描和查看其他設備。 當我使用 Note 10 時,它不會顯示附近的藍牙設備。 我也啟用了位置設置。 如果有人可以幫助我,我將不勝感激。

2020-09-15 17:09:29.953 12536-12536/? E/Zygote: accessInfo : 1
2020-09-15 17:09:29.976 12536-12536/? I/aixbluetoothap: Late-enabling -Xcheck:jni
2020-09-15 17:09:29.990 12536-12536/? E/aixbluetoothap: Unknown bits set in runtime_flags: 0x8000
2020-09-15 17:09:29.998 12536-12536/? D/ActivityThread: setConscryptValidator
2020-09-15 17:09:29.998 12536-12536/? D/ActivityThread: setConscryptValidator - put
2020-09-15 17:09:30.240 12536-12536/com.example.maixbluetoothapp D/PhoneWindow: forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4268 com.android.internal.policy.DecorView.updateColorViews:1494 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3246 android.view.Window.setFlags:1148 com.android.internal.policy.PhoneWindow.generateLayout:2474 
2020-09-15 17:09:30.241 12536-12536/com.example.maixbluetoothapp I/MultiWindowDecorSupport: updateCaptionType >> DecorView@218acd4[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2020-09-15 17:09:30.241 12536-12536/com.example.maixbluetoothapp D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@218acd4[]
2020-09-15 17:09:30.286 12536-12536/com.example.maixbluetoothapp D/DeviceScanActivity: Request Location Permissions:
2020-09-15 17:09:30.330 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: startLeScan(): null
2020-09-15 17:09:30.331 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:30.332 12536-12536/com.example.maixbluetoothapp I/chatty: uid=10321(com.example.maixbluetoothapp) identical 1 line
2020-09-15 17:09:30.333 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:30.333 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: BLE support array set: 111111
2020-09-15 17:09:30.334 12536-12536/com.example.maixbluetoothapp D/BluetoothLeScanner: Start Scan with callback
2020-09-15 17:09:30.336 12536-12664/com.example.maixbluetoothapp D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=12 mScannerId=0
2020-09-15 17:09:30.732 12536-12536/com.example.maixbluetoothapp D/ViewRootImpl@680f8ff[DeviceScanActivity]: setView = com.android.internal.policy.DecorView@218acd4 TM=true MM=false
2020-09-15 17:09:30.764 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: stopLeScan()
2020-09-15 17:09:30.765 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:30.771 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:30.771 12536-12536/com.example.maixbluetoothapp D/BluetoothLeScanner: Stop Scan with callback
2020-09-15 17:09:30.824 12536-12536/com.example.maixbluetoothapp D/ViewRootImpl@680f8ff[DeviceScanActivity]: Relayout returned: old=(0,0,1440,3040) new=(0,0,1440,3040) req=(1440,3040)0 dur=20 res=0x7 s={true 491187228672} ch=true
2020-09-15 17:09:30.824 12536-12616/com.example.maixbluetoothapp D/OpenGLRenderer: createReliableSurface : 0x71c9c1b1c0(0x725d0a5000)
2020-09-15 17:09:30.824 12536-12616/com.example.maixbluetoothapp I/AdrenoGLES: QUALCOMM build                   : 128c575, I000594fe7d
    Build Date                       : 02/02/20
    OpenGL ES Shader Compiler Version: EV031.27.05.03
    Local Branch                     : 
    Remote Branch                    : refs/tags/AU_LINUX_ANDROID_LA.UM.8.1.R1.10.00.00.529.103
    Remote Branch                    : NONE
    Reconstruct Branch               : NOTHING
2020-09-15 17:09:30.824 12536-12616/com.example.maixbluetoothapp I/AdrenoGLES: Build Config                     : S P 8.0.11 AArch64
2020-09-15 17:09:30.827 12536-12616/com.example.maixbluetoothapp I/AdrenoGLES: PFP: 0x016ee187, ME: 0x00000000
2020-09-15 17:09:30.844 12536-12536/com.example.maixbluetoothapp D/AbsListView:  in onLayout changed 
2020-09-15 17:09:30.861 12536-12616/com.example.maixbluetoothapp D/OpenGLRenderer: makeCurrent EglSurface : 0x0 -> 0x0
2020-09-15 17:09:30.888 12536-12616/com.example.maixbluetoothapp D/OpenGLRenderer: makeCurrent EglSurface : 0x0 -> 0x71c9c2bd00
2020-09-15 17:09:30.889 12536-12616/com.example.maixbluetoothapp W/Gralloc3: mapper 3.x is not supported
2020-09-15 17:09:31.015 12536-12536/com.example.maixbluetoothapp D/ViewRootImpl@680f8ff[DeviceScanActivity]: MSG_RESIZED_REPORT: frame=(0,0,1440,3040) ci=(0,114,0,53) vi=(0,114,0,53) or=1
2020-09-15 17:09:31.113 12536-12536/com.example.maixbluetoothapp D/DeviceScanActivity: coarse location permission granted
2020-09-15 17:09:31.114 12536-12536/com.example.maixbluetoothapp D/ViewRootImpl@680f8ff[DeviceScanActivity]: stopped(false) old=false
2020-09-15 17:09:31.115 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: startLeScan(): null
2020-09-15 17:09:31.115 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:31.116 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:31.116 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:31.117 12536-12536/com.example.maixbluetoothapp D/BluetoothLeScanner: Start Scan with callback
2020-09-15 17:09:31.118 12536-12568/com.example.maixbluetoothapp D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=12 mScannerId=0
2020-09-15 17:09:40.339 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: stopLeScan()
2020-09-15 17:09:40.341 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:40.342 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:40.342 12536-12536/com.example.maixbluetoothapp D/BluetoothLeScanner: Stop Scan with callback
2020-09-15 17:09:41.117 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: stopLeScan()
2020-09-15 17:09:41.119 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: STATE_ON
2020-09-15 17:09:41.119 12536-12536/com.example.maixbluetoothapp D/BluetoothAdapter: scan not started yet

下面是我的日志文件。

https://android.googlesource.com/platform/development/+/f8a92396babb6592bb8780866def23795f3dab70/samples/BluetoothLeGatt/src/com/example/bluetooth/le

以上鏈接供我項目參考。

我在使用 Android 10 操作系統的三星設備上遇到了同樣的問題。 您是否嘗試按照發行說明中的​​說明更改位置權限?

盡管我這樣做了,但他們仍然根本沒有列出附近的設備。 所以我嘗試格式化這些設備之一:Samsung Galaxy Tab A8。 制造重置后,我得到了它的工作。 在我格式化設備之前,我看到了 BluetoothAdaptor API 的控制台日志:

D/BluetoothAdapter: BLE support array set: 010011

但是這個日志在我格式化后就消失了。 這可能是新Android 10系統的一個bug。 因為我在Android 10下的系統上沒有遇到過這個問題。

更新:

您還必須確保設備的位置已打開。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM