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 连接 的相关文章

  • 如何自定义菜单项的背景颜色?

    我正在尝试定制Toolbar的弹出菜单 现在我无法设置菜单项的背景颜色 我的 styles xml 如下所示
  • Android短音的正确播放方法?

    我正在创建一个应用程序 屏幕上将有多个图像 这些图像将是按钮 点击时会播放短促的声音 我对此进行了研究 只能找到我当前用来播放声音的方法 这似乎根本没有响应 我希望声音能够快速播放并且能够响应多次快速点击 我不确定这在 Android 中是
  • Cheesesquare:enterAlways 会产生错误的布局

    Adding enterAlways到 Cheesesquare 演示的滚动标志
  • AdapterContextMenuInfo 始终为 null

    我尝试通过 android 开发文档中的书来做到这一点 this didn t create a menu i don t know why registerForContextMenu getListView setListAdapter
  • 如何正确释放Android MediaPlayer

    我正在尝试向我的 Android 应用程序添加一个按钮 当点击该按钮时它会播放 MP3 我已经让它工作了 但没有办法释放 mediaPlayer 对象 因此即使在我离开活动后它仍然会继续播放 如果我在react 方法之外初始化MediaPl
  • Android Q:file.mkdirs() 返回 false

    我们有一个应用程序 使用外部存储来存储一些临时文件 图像 二进制数据 该代码已经运行了几年 直到最近才发生重大变化 在 Android Q 上它不起作用 File f new File Environment getExternalStor
  • 如何在我现有的 Android 应用程序中使用 Telegram API(包括聊天应用程序)?

    我想使用 telegram API 在我现有的 Android 应用程序中开发聊天功能 我不知道如何实施 我认为 看看Telegram 数据库库 测试版 从这里TDLib https core telegram org tdlib 俄语 但
  • 如何更改终端的默认目录?

    我想更改 Android Studio v2 2 2 终端的默认目录 当我打开终端时 它基于项目的目录 C 项目路径 我经常需要使用adb shell 所以我必须导航到 SDK 路径 平台工具 才能使用 adb 命令 是否可以更改终端的默认
  • Android 深度链接至 Instagram 应用

    Instagram 已经发布了 iOS 深层链接的 url 方案 但尚未为 Android 创建文档 有没有办法深入链接到 Android 上的 Instagram 应用程序 以转到 Instagram 应用程序中的特定位置 例如 Inst
  • Android Eclipse 上的 Web 服务

    我是 android eclipse java 的新手 事实上这个论坛也是如此 有人遇到过这种情况吗 从用户那里获取输入并通过使用 android eclipse 中的 Web 服务来显示适当的结果 有可用的示例吗 非常感谢 我正在发布教程
  • Android:后台Activity可以执行代码吗?

    后台的活动是否被视为 正在运行 并且可以执行代码 还是处于挂起状态 他们暂停了 活动生命周期 http developer android com reference android app Activity html ActivityLi
  • 图像作为电子邮件附件

    我想构建一个应用程序 我可以在电子邮件中附加图像 打开图像并将其设置为我的壁纸 我想让它跨平台 所以你能告诉我是否可以使用phonegap 或者我是否必须为iphone和android构建一个本机应用程序 您好 如果您只想通过电子邮件附加图
  • 如何在谷歌地图android上显示多个标记

    我想在谷歌地图android上显示带有多个标记的位置 问题是当我运行我的应用程序时 它只显示一个位置 标记 这是我的代码 public class koordinatTask extends AsyncTask
  • 使用片段时应用程序崩溃

    我正在处理碎片和 我的代码中有一个我找不到的问题 logcat 指向我的一个片段中的这段代码 Override public View onCreateView LayoutInflater inflater ViewGroup conta
  • Android 中如何通过彩信发送图片?

    我正在开发多媒体应用程序 我正在通过相机捕获一张图像 并希望将该图像和文本发送到其他号码 但我不知道如何通过彩信发送图像 MMS 只是一个 http post 请求 您应该使用执行请求额外的网络功能 final ConnectivityMa
  • 通过Python连接到Bigquery:ProjectId和DatasetId必须非空

    我编写了以下脚本来通过 SDK 将 Big Query 连接到 Python 如下所示 from google cloud import bigquery client bigquery Client project My First Pr
  • 您使用什么物理 Android 设备进行测试?

    有什么好的推荐用于测试目的的物理 Android 设备吗 我正在苹果阵营寻找像 iPod touch 这样的设备 可以帮助 iOS 开发人员测试他们的东西 我知道有 Nexus One 但那东西相当昂贵 而且我并不真正关心手机的东西 而是可
  • 在命令行上卸载 Android SDK 的选定部分

    这与 卸载旧的 Android SDK 版本 https stackoverflow com questions 15182377 uninstall old android sdk versions 除非我想在无头 Linux CI 服务
  • 通过系统应用程序以编程方式静默安装 apk(无需 root)

    我有带有 android sharedUserId android uid system UID 1000 的系统级应用程序 设备未root INSTALL PACKAGES 权限包含在清单中 我可以静默安装下载的 apk 吗 我已经发现这
  • 通过电子邮件发送文本文件附件

    我正在尝试附加一个文本文件以便通过电子邮件发送 但每当我打开电子邮件应用程序时 它都会说该文件不存在 请帮助 Intent i new Intent Intent ACTION SEND i setType text plain i put

随机推荐

  • 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 手机和平板电脑上一切似乎都工作正常 连接 数据传输以及断开连接后重新连接 注意 我们不配对我们的设备 它只是连接 并且我们不使用自动连接 现在的问题是 有时某些设备