BLE 设备在完美工作数周后停止与 Android 连接

2024-01-04

我有一台配备 Blue Gecko BLE 的设备,在各种 Android 手机和平板电脑上一切似乎都工作正常:连接、数据传输以及断开连接后重新连接。注意:我们不配对我们的设备,它只是连接,并且我们不使用自动连接。

现在的问题是:有时某些设备的电话设置连接在工作几周后会停止运行。我不知道这种情况何时或为何发生,但之后就无法使用之前完美运行的同一部手机重新连接设备。该设备与其他手机仍可正常使用。而且这款手机可以与其他设备配合使用。我们尝试了各种技巧:重新启动手机、卸载并重新安装应用程序、重置设备。这些都不起作用。我们能够重新连接的唯一方法是从手机设置中删除蓝牙数据(重置网络和蓝牙或仅从手机应用程序设置中删除蓝牙数据)。原因是什么?我们该如何解决这个问题?有任何想法吗?

线索: 从电话中查看 btsnoop_hci.log,似乎当连接开始失败时,对“Sent LE Create Connection”的响应是“Command disallowed”。

查看 logcat,我看到“获得状态 133 和状态 0”,这会导致我们的应用程序中的蓝牙重置。

连接状态检查每 5 秒进行一次,然后重新连接...如果需要的话。

出现问题时,使用同一部手机的其他应用程序无法连接到该设备。就像设备被列入黑名单一样,可以通过删除蓝牙数据来清除。

我希望有人能够帮助解决这个问题。 提前致谢!

EDIT:我被要求提供一些 HCI 日志,所以就在这里。帧 28305 和 28309 具有创建连接命令,而帧 28306 和 28310 具有状态响应:“命令不允许 (0x0c)”

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28304 93430.042972   Aug 12, 2018 13:39:19.747836000 FLE Daylight Time host                  Rcvd Command Complete (LE Add Device To White List)             HCI_EVT                                                     

Frame 28304: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:19.747836000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070359.747836000 seconds
    [Time delta from previous captured frame: 0.000870000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 93430.042972000 seconds]
    Frame Number: 28304
    Frame Length: 7 bytes (56 bits)
    Capture Length: 7 bytes (56 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Received (1)
    [Protocols in frame: bluetooth:hci_h4:bthci_evt]
Bluetooth
    [Source: controller]
    [Destination: host]
Bluetooth HCI H4
    [Direction: Rcvd (0x01)]
    HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Complete
    Event Code: Command Complete (0x0e)
    Parameter Total Length: 4
    Number of Allowed Command Packets: 1
    Command Opcode: LE Add Device To White List (0x2011)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0001 0001 = Opcode Command Field: LE Add Device To White List (0x011)
    Status: Success (0x00)
    [Command in frame: 28303]
    [Command-Response Delta: 0.87ms]

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28305 93430.043242   Aug 12, 2018 13:39:19.748106000 FLE Daylight Time controller            Sent LE Create Connection                                       HCI_CMD                                                     Use White List. Ignore Peer Address

Frame 28305: 29 bytes on wire (232 bits), 29 bytes captured (232 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:19.748106000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070359.748106000 seconds
    [Time delta from previous captured frame: 0.000270000 seconds]
    [Time delta from previous displayed frame: 0.000270000 seconds]
    [Time since reference or first frame: 93430.043242000 seconds]
    Frame Number: 28305
    Frame Length: 29 bytes (232 bits)
    Capture Length: 29 bytes (232 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Sent (0)
    [Protocols in frame: bluetooth:hci_h4:bthci_cmd]
    [Coloring Rule Name: ___conversation_color_filter___06]
    [Coloring Rule String: bthci_cmd.opcode == 0x200d]
Bluetooth
    [Source: host]
    [Destination: controller]
Bluetooth HCI H4
    [Direction: Sent (0x00)]
    HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - LE Create Connection
    Command Opcode: LE Create Connection (0x200d)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0000 1101 = Opcode Command Field: LE Create Connection (0x00d)
    Parameter Total Length: 25
    Scan Interval: 2048 (1280 msec)
    Scan Window: 128 (80 msec)
    Initiator Filter Policy: Use White List. Ignore Peer Address (0x01)
    Peer Address Type: Public Device Address (0x00)
    BD_ADDR: 00:00:00_00:00:00 (00:00:00:00:00:00)
    Own Address Type: Random Device Address (0x01)
    Connection Interval Min: 24 (30 msec)
    Connection Interval Max: 40 (50 msec)
    Connection Latency: 0 (number events)
    Supervision Timeout: 2000 (20 sec)
    Min CE Length: 0 (0 msec)
    Max CE Length: 0 (0 msec)
    [Response in frame: 28306]
    [Command-Response Delta: 0.607ms]

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28306 93430.043849   Aug 12, 2018 13:39:19.748713000 FLE Daylight Time host                  Rcvd Command Status (LE Create Connection)                      HCI_EVT                                                     

Frame 28306: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:19.748713000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070359.748713000 seconds
    [Time delta from previous captured frame: 0.000607000 seconds]
    [Time delta from previous displayed frame: 0.000607000 seconds]
    [Time since reference or first frame: 93430.043849000 seconds]
    Frame Number: 28306
    Frame Length: 7 bytes (56 bits)
    Capture Length: 7 bytes (56 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Received (1)
    [Protocols in frame: bluetooth:hci_h4:bthci_evt]
    [Coloring Rule Name: ___conversation_color_filter___01]
    [Coloring Rule String: bthci_evt.status == 0x0c]
Bluetooth
    [Source: controller]
    [Destination: host]
Bluetooth HCI H4
    [Direction: Rcvd (0x01)]
    HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Status
    Event Code: Command Status (0x0f)
    Parameter Total Length: 4
    Status: Command Disallowed (0x0c)
    Number of Allowed Command Packets: 1
    Command Opcode: LE Create Connection (0x200d)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0000 1101 = Opcode Command Field: LE Create Connection (0x00d)
    [Command in frame: 28305]
    [Command-Response Delta: 0.607ms]

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28307 93430.044054   Aug 12, 2018 13:39:19.748918000 FLE Daylight Time controller            Sent LE Create Connection Cancel                                HCI_CMD                                                     

Frame 28307: 4 bytes on wire (32 bits), 4 bytes captured (32 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:19.748918000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070359.748918000 seconds
    [Time delta from previous captured frame: 0.000205000 seconds]
    [Time delta from previous displayed frame: 0.000205000 seconds]
    [Time since reference or first frame: 93430.044054000 seconds]
    Frame Number: 28307
    Frame Length: 4 bytes (32 bits)
    Capture Length: 4 bytes (32 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Sent (0)
    [Protocols in frame: bluetooth:hci_h4:bthci_cmd]
Bluetooth
    [Source: host]
    [Destination: controller]
Bluetooth HCI H4
    [Direction: Sent (0x00)]
    HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - LE Create Connection Cancel
    Command Opcode: LE Create Connection Cancel (0x200e)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0000 1110 = Opcode Command Field: LE Create Connection Cancel (0x00e)
    Parameter Total Length: 0
    [Response in frame: 28308]
    [Command-Response Delta: 2.721ms]

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28308 93430.046775   Aug 12, 2018 13:39:19.751639000 FLE Daylight Time host                  Rcvd Command Complete (LE Create Connection Cancel)             HCI_EVT                                                     

Frame 28308: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:19.751639000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070359.751639000 seconds
    [Time delta from previous captured frame: 0.002721000 seconds]
    [Time delta from previous displayed frame: 0.002721000 seconds]
    [Time since reference or first frame: 93430.046775000 seconds]
    Frame Number: 28308
    Frame Length: 7 bytes (56 bits)
    Capture Length: 7 bytes (56 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Received (1)
    [Protocols in frame: bluetooth:hci_h4:bthci_evt]
    [Coloring Rule Name: ___conversation_color_filter___01]
    [Coloring Rule String: bthci_evt.status == 0x0c]
Bluetooth
    [Source: controller]
    [Destination: host]
Bluetooth HCI H4
    [Direction: Rcvd (0x01)]
    HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Complete
    Event Code: Command Complete (0x0e)
    Parameter Total Length: 4
    Number of Allowed Command Packets: 1
    Command Opcode: LE Create Connection Cancel (0x200e)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0000 1110 = Opcode Command Field: LE Create Connection Cancel (0x00e)
    Status: Command Disallowed (0x0c)
    [Command in frame: 28307]
    [Command-Response Delta: 2.721ms]

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28309 93434.163337   Aug 12, 2018 13:39:23.868201000 FLE Daylight Time controller            Sent LE Create Connection                                       HCI_CMD                                                     Use Peer Address

Frame 28309: 29 bytes on wire (232 bits), 29 bytes captured (232 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:23.868201000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070363.868201000 seconds
    [Time delta from previous captured frame: 4.116562000 seconds]
    [Time delta from previous displayed frame: 4.116562000 seconds]
    [Time since reference or first frame: 93434.163337000 seconds]
    Frame Number: 28309
    Frame Length: 29 bytes (232 bits)
    Capture Length: 29 bytes (232 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Sent (0)
    [Protocols in frame: bluetooth:hci_h4:bthci_cmd]
    [Coloring Rule Name: ___conversation_color_filter___06]
    [Coloring Rule String: bthci_cmd.opcode == 0x200d]
Bluetooth
    [Source: host]
    [Destination: controller]
Bluetooth HCI H4
    [Direction: Sent (0x00)]
    HCI Packet Type: HCI Command (0x01)
Bluetooth HCI Command - LE Create Connection
    Command Opcode: LE Create Connection (0x200d)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0000 1101 = Opcode Command Field: LE Create Connection (0x00d)
    Parameter Total Length: 25
    Scan Interval: 96 (60 msec)
    Scan Window: 48 (30 msec)
    Initiator Filter Policy: Use Peer Address (0x00)
    Peer Address Type: Public Device Address (0x00)
    BD_ADDR: SiliconL_23:5e:25 (90:fd:9f:23:5e:25)
    Own Address Type: Random Device Address (0x01)
    Connection Interval Min: 24 (30 msec)
    Connection Interval Max: 40 (50 msec)
    Connection Latency: 0 (number events)
    Supervision Timeout: 2000 (20 sec)
    Min CE Length: 0 (0 msec)
    Max CE Length: 0 (0 msec)
    [Response in frame: 28310]
    [Command-Response Delta: 8.734ms]

No.     Time           Arrival Time Destination           Info                                                            Protocol BD_ADDR    Destination Source     Unexpected event Initiator Filter Policy
  28310 93434.172071   Aug 12, 2018 13:39:23.876935000 FLE Daylight Time host                  Rcvd Command Status (LE Create Connection)                      HCI_EVT                                                     

Frame 28310: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)
    Encapsulation type: Bluetooth H4 with linux header (99)
    Arrival Time: Aug 12, 2018 13:39:23.876935000 FLE Daylight Time
    [Time shift for this packet: 0.000000000 seconds]
    Epoch Time: 1534070363.876935000 seconds
    [Time delta from previous captured frame: 0.008734000 seconds]
    [Time delta from previous displayed frame: 0.008734000 seconds]
    [Time since reference or first frame: 93434.172071000 seconds]
    Frame Number: 28310
    Frame Length: 7 bytes (56 bits)
    Capture Length: 7 bytes (56 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    Point-to-Point Direction: Received (1)
    [Protocols in frame: bluetooth:hci_h4:bthci_evt]
    [Coloring Rule Name: ___conversation_color_filter___01]
    [Coloring Rule String: bthci_evt.status == 0x0c]
Bluetooth
    [Source: controller]
    [Destination: host]
Bluetooth HCI H4
    [Direction: Rcvd (0x01)]
    HCI Packet Type: HCI Event (0x04)
Bluetooth HCI Event - Command Status
    Event Code: Command Status (0x0f)
    Parameter Total Length: 4
    Status: Command Disallowed (0x0c)
    Number of Allowed Command Packets: 1
    Command Opcode: LE Create Connection (0x200d)
        0010 00.. .... .... = Opcode Group Field: LE Controller Commands (0x08)
        .... ..00 0000 1101 = Opcode Command Field: LE Create Connection (0x00d)
    [Command in frame: 28309]
    [Command-Response Delta: 8.734ms]

EDIT 2:

以下是从 Wireshark 导出的 hci 日志文件的链接:

https://www.dropbox.com/s/6t8hqde4a9mxt0u/btsnoop_hci_1_cut.log?dl=0 https://www.dropbox.com/s/6t8hqde4a9mxt0u/btsnoop_hci_1_cut.log?dl=0

这是与纯文本相同的数据的链接:

https://www.dropbox.com/s/o4lzoyxkg7gk8de/btsnoop_hci_1_cut.TXT?dl=0 https://www.dropbox.com/s/o4lzoyxkg7gk8de/btsnoop_hci_1_cut.TXT?dl=0

应用的过滤器:frame.number > 17025 && frame.number

EDIT 3:

这是连接设备的代码。正如我所说,我没有使用自动连接。我确实希望尽可能可靠、快速地重新连接。如果连接丢失,我会定期(每 5 秒)调用此 connectBLEDevice。

private void connectBLEDevice() {
    Log.d(TAG, "Start connect...");

    if (btIsConnected) {
        Log.e(TAG, "connectBLEDevice: do nothing because btIsConnected");

        return;
    }
    Log.d(TAG, "connectBLEDevice: currentDevice = " + currentDevice);
    Log.d(TAG, "connectBLEDevice: BT CONNECTION STATE = " + bluetoothManager.getConnectionState(currentDevice, BluetoothProfile.GATT) + " (0 = disconnected, 1 = connecting, 2 = connected, 3 = disconnecting)");
    if (currentDevice != null) {
        if (bluetoothManager.getConnectionState(currentDevice, BluetoothProfile.GATT) == BluetoothProfile.STATE_CONNECTED
                || bluetoothManager.getConnectionState(currentDevice, BluetoothProfile.GATT) == BluetoothProfile.STATE_CONNECTING
                || bluetoothManager.getConnectionState(currentDevice, BluetoothProfile.GATT) == BluetoothProfile.STATE_DISCONNECTING) {
            Log.d("debug", "connectBLEDevice: connectBLEDevice ALREADY CONNECTED --> do nothing");

            if(deviceConnectionRetryCount%30 != 0){
                return;
            }else { // RESET BT IF not communicating but BT claims to be connected for too long
                Log.d("debug", "connectBLEDevice: STILL NOT COMMUNICATING for too long (2-3min) --> try to reconnect");
            }
        }
    }

    Log.e(TAG, "connectBLEDevice: Starting service discovery");
    if (btGatt == null) {

        // I was told  there should be delay before connecting after disconnection (this could be accessed if user start and stop the service very fast)
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public void run() {
                Log.d("debug", "connectBLEDevice: connectGatt in BLESERVICE");
                btGatt = currentDevice.connectGatt(BleService.this, false, gattCb);
            }
        }, 500);


    } else {
        Log.d(TAG, "connectBLEDevice: btGatt != null --> Disconnect BLE");
        btGatt.disconnect();

        // I was told  there should be delay before connecting after disconnection 
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public void run() {
                try {
                    boolean success = btGatt.connect();

                    if (!success || (deviceConnectionRetryCount > 0 && deviceConnectionRetryCount%10==0)) {
                        Log.d("debug", "connectBLEDevice: connect in BLESERVICE Failed OR retried 10 times (~ 1min) --> reset BT");
                        resetBluetooth();
                    }else{
                        Log.d("debug", "connectBLEDevice: connect in BLESERVICE Success");
                    }
                }
                catch (Exception e){
                    Log.e(TAG, "connectBLEDevice: Unable to connect BLE device (null pointer) --> reset BT", e);
                    resetBluetooth();
                }
            }
        }, 500);

    }

}

这是重置蓝牙的代码

private void resetBluetooth() {
    Log.e(TAG, "*** Reseting Bluetooth! ***");
    if (mGattManager != null) {
        mGattManager.cancelCurrentOperationBundle();
        disconnect(currentDevice);
        mGattManager = null;
    }

    if (btGatt != null) {
        btGatt.disconnect();
        refreshDeviceCache(btGatt);
        try {
            btGatt.close();
        }
        catch (Exception e){
            Log.e(TAG, "An exception occurred while closing btGatt");
        }
    }

    initBluetooth();
    btGatt = null;
}

android P 之后不要调用refreshDeviceCache(btGatt)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

BLE 设备在完美工作数周后停止与 Android 连接 的相关文章

  • 如何为android数据绑定点击监听器编写proguard规则?

    我在用databinding在我的应用程序中 它运行良好 但是当我启用minifyEnabled true and shrinkResources true比它告诉我一些错误 Execution failed for task app tr
  • Kotlin Android Firebase 数据库哈希映射转换为类

    我正在尝试从 firebase 数据库获取数据 断点显示它正在获取数据 但看起来我没有正确地将其分配给我的班级 这会导致此异常 java lang ClassCastException 无法将 java util HashMap 转换为 班
  • 配置项目 ':react-native-gesture-handler' 时出现问题

    大家好 我已经尝试了很长时间来解决这个问题 但不幸的是我还没有弄清楚如何解决 希望你们能帮助我 所以我有一个反应本机项目和我的朋友 以及我的一位朋友添加 React native gesture handler 包供我们使用 他对这个包没有
  • Phonegap(应用程序错误...发生网络错误)

    我已经使用phonegap 创建了一个版本 在index html 文件中 我编写了一个简单的iframe 用于加载网站 当我从phonegap获取本地url时它就起作用了 但如果我将整个构建作为 zip 文件上传到 PhoneGap 中
  • 需要对某些片段禁用 CollapsingToolbarLayout 的展开

    我有一个AppCompatActivity控制替换许多片段 这是我的布局 活动 main xml
  • 清晰的图标 清晰的 Android 应用程序

    你好 下午好 关于如何提高图标的 png 质量 有什么想法吗 我使用了 Android 开发者页面上的套件 但我无法获得清晰的图像 我的意思是非常清晰 我是否需要以不同的方式加载此图标 而不仅仅是拖入我的布局 谢谢 我使用这个布局
  • 将项目添加到 android 框架的设置中

    我正在 android 框架中工作 我想向 android 操作系统中的现有设置添加一个项目 您能告诉我如何执行此操作吗 首先阅读有关偏好活动 http developer android com reference android pre
  • 如何连接到Google Play服务并加载排行榜

    我想将我的游戏与 Google Play 服务连接 我已阅读有关 Android 开发人员的文档 并尝试遵循输入数字示例 但仍然无法加载排行榜 我有导入baseGameUtils 但我使用andengine 所以我没有使用来自谷歌的exte
  • 在活动启动期间优雅地处理屏幕方向变化

    我正在尝试找到一种方法来正确处理设置活动 其中活动的方向是根据启动它的意图中的数据确定的 这是一款用户可以选择关卡的游戏 其中一些是纵向的 一些是横向的 我面临的问题是setRequestedOrientation ActivityInfo
  • MediaPlayer.create() 始终返回 null

    我以前用过媒体播放器 从来没有遇到过这个问题 每当我尝试使用 MediaPlayer create 时 该方法都会给我 null 并且我无法播放声音 我有什么遗漏的吗 public class Game extends Activity p
  • Android 游戏偶尔出现延迟

    我正在用 Java 制作一个简单的 Android 游戏 我注意到每 20 40 秒就会出现一些烦人的延迟 首先 我认为它们是由垃圾收集器引起的 但当我检查 LogCat 时 我发现游戏滞后时没有垃圾收集 每当游戏开始滞后时 我都会标记日志
  • Android中如何使用intent加载本地html页面?

    我的 asset 目录中有一个 html 文件 我必须使用 Intent 将其加载为浏览器应用程序 这是我的代码 但它不起作用 startActivity new Intent Intent ACTION VIEW Uri parse fi
  • 本地管理的广播接收器泄漏?

    当应用程序被系统杀死时 本地 即使用 LocalBroadcastManager 管理 BroadcastReceiver 是否有可能泄漏 我需要它的具体用例是我想在活动的 onCreate onDestroy 中注册 注销 Broadca
  • Android 5 Lollipop 阴影方向或 y 偏移

    是否有可能改变 Y 偏移的阴影方向 现在我有以下布局
  • Android:选择 EditField 上焦点上的所有文本

    我试图让 Android 在获得焦点时选择 EditText 字段中的所有文本 我在布局中使用此属性 在两个字段上 android selectAllOnFocus true 我不确定这是否相关 但为了将光标移动到第一个可编辑字段 前面 还
  • 在 VideoView 开始播放之前,TextView 不会显示

    我编写了一个android应用程序 它有两个视图 TextView上方的VideoView 位于ScrollView内部 我遇到了一个问题 直到VideoView开始播放视频 TextView才显示 并且我有一个黑屏 这可能需要很长一段时间
  • FCM 主题是否适合更多用户?

    我对使用主题消息有点困惑 我的场景是根据通知触发一些作业 请帮助我更多地了解这一点 如果我们正在处理大量用户 则可以使用 FCM 主题向用户发送通知 我们可以只使用数据消息和主题消息吗 使用主题发送的消息是否保证送达 我在 FCM 文档中看
  • 将主题应用到 v7 支持操作栏

    我正在使用support v7库来实现ActionBar在我的应用程序中 我的styles xml file
  • Android Webview隐私浏览

    我在我的 Android 应用程序中使用 webview 从多个站点获取一些网页 我对 webview 行为有一些疑问 webview 是否存储历史记录 cookie 表单自动填充信息 如果是的话 我们可以阻止它这样做吗 如果 Webvie
  • android.view.WindowLeaked - 使用对话框和新意图时

    我已经尝试了 stackoverflow 上提供的所有可能的解决方案 但我仍然在 logcat 中遇到此错误 活动 com xyz MainActivity 泄露了最初在此处添加的窗口 com android internal policy

随机推荐

  • WSFederationAuthenticationModule v/s SessionAuthenticationModule

    根据文档 这两个模块都将用于创建 IClaimsPrincipal 的实例 我不明白为什么 WIF 费心使用 2 个 HttpModules 而不是 1 个 抱歉 我是 WIF 新人 最大的区别在于 WSFederationAuthenti
  • 禁用 JShell 历史记录

    默认情况下 JShell 启用所有键入内容的持久历史记录 可以通过按向上箭头来调用 关闭此 功能 的设置在哪里 另外 我如何清除当前历史记录 也许我比较笨 但是我不明白这个命令 reset似乎什么也没做 另外 我如何清除当前历史记录 我提出
  • 为什么用Java VisualVM监控Tomcat时堆空间不断增大?

    我有一个在 Tomcat 中运行的 JRubyOnRails 应用程序 浏览到我的应用程序 localhost 登录然后什么都不做后 堆空间似乎在不断增长 这正常吗 如果我按 执行 GC 它会再次下降 我想知道如果我将其保留到其达到计算机
  • Findbugs android gradle 插件

    我有一个安卓项目 我想介绍findbugs在我的项目中作为 gradle 插件 我尝试编辑项目的build gradle如下 buildscript repositories mavenCentral maven url https mav
  • Intent.EXTRA_EMAIL 未填充“收件人”字段

    我正在尝试使用intent questions tagged intent从我的应用程序发送电子邮件 但电子邮件的 收件人 字段不会填充 如果我添加代码来填写主题或文本 它们就可以正常工作 仅 收件人 字段不会填充 我也尝试将类型更改为 t
  • 从文件中的每一行创建一个字典

    我正在尝试从这个文件创建一个字典 键是第一个单词 值是后面的所有单词 andrew fred fred judy andrew fred george judy andrew john george 这是我的代码 follows file
  • AngularJS - 启用 HTML5 模式页面刷新而不会出现 404 错误 [重复]

    这个问题在这里已经有答案了 我也尝试通过设置 locationProvider html5Mode true 在 ui routing 和 base href 中它删除了哈希值 但在刷新时它给出了404错误 请帮帮我 正如其他人所说 启用
  • 在重复的动态类型部分视图中从匿名类型属性发出 HTML 字符串

    我将匿名类型传递到动态部分视图中作为 model 其中一个属性是包含一些 HTML 的字符串 当我使用HtmlHelper方法来呈现属性 Razor 引擎正在对字符串进行编码 从而在页面上生成文字文本 i text i 在这种情况下 而不是
  • PowerShell 舍入和格式浮点到最多 2 位小数?

    我发现了很多东西可以将浮点数格式化为常见的已知数字 但是如何将浮点数格式化为最多 2 位小数 但前提是需要小数 例子 1 11 not 1 111 1 12 it was 1 116 round up 1 1 not 1 10 1 not
  • 逐行比较 2 个数据帧的随时间分析

    这是我正在使用的数据框的一小部分 以供参考 https i stack imgur com 7fdwL jpg我正在 R 中使用一个数据框 MG53 HanLab 其中有一列时间 几列名称为 MG53 的列 几列名称为 F2 的列以及几列名
  • 有没有办法让 git 忽略整个分支?

    这可能违背了 git 的设计理念 但是 在我的组织中 我不断地删除数千个开发人员分支 例如Dev
  • std 函数 std::_Rb_tree_rebalance_for_erase () 中的分段错误

    请注意未来的读者 不出所料 错误出现在我的代码中 而不是 std Rb tree rebalance for erase 我对编程有点陌生 不确定如何处理似乎来自 std 函数的分段错误 我希望我做了一些愚蠢的事情 即滥用容器 因为我不知道
  • ValidationMessages.properties 文件之间的冲突

    我习惯将所有验证约束收集在一个公共库中 在罐子的根部我放了一个ValidationMessages it properties文件 一切正常 如果我将此库放入 jsf 2 war 项目中 所有验证消息都会正确显示 但是 如果我再放一个 就会
  • JS/CSS 幻灯片效果适用于小提琴,不适用于 html

    我的第一个问题是小提琴不工作 现在它可以工作了 但是如果我将它复制到括号文件中 它就不再工作了 我确实包含了放置在外部资源中的链接 这是小提琴 https jsfiddle net wtbdxx2b 6 https jsfiddle net
  • Python 更新 SQL 数据库时出错

    我有一些看起来像这样的 python 代码 import pypyodbc import pandas as pd home c SQL df pd read sql query sql4 conn3 for y1 in range 0 k
  • 获取已安装服务的版本信息?

    我想以编程方式检查是否安装了最新版本的 Windows 服务 我有 var ctl ServiceController GetServices Where s gt s ServiceName MyService FirstOrDefaul
  • PHP 执行时显示加载图像

    我想在 php 脚本执行时显示加载图像 我读过关于如何做到这一点的不同答案 但大多数人都说我应该有一个单独的 php 页面 但是我使用单页来显示行 那么如何才能显示加载图像 我用来获取数据的选择查询示例 stmt mydb gt prepa
  • 在长字符串中插入换行符——自动换行

    这是我编写的一个函数 用于将长字符串分成不长于给定长度的行 strBreakInLines lt function s breakAt 90 prepend words lt unlist strsplit s if length word
  • android - 启动另一个应用程序的活动以获取其结果

    我有两个应用程序 A 和 B 我从 A 启动 B 以获取结果 使用以下代码 Intent fmIntent getPackageManager getLaunchIntentForPackage com example B fmIntent
  • BLE 设备在完美工作数周后停止与 Android 连接

    我有一台配备 Blue Gecko BLE 的设备 在各种 Android 手机和平板电脑上一切似乎都工作正常 连接 数据传输以及断开连接后重新连接 注意 我们不配对我们的设备 它只是连接 并且我们不使用自动连接 现在的问题是 有时某些设备