久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='eR1zi'><style id='eR1zi'><dir id='eR1zi'><q id='eR1zi'></q></dir></style></legend>

      <bdo id='eR1zi'></bdo><ul id='eR1zi'></ul>
    <tfoot id='eR1zi'></tfoot>

        <small id='eR1zi'></small><noframes id='eR1zi'>

        <i id='eR1zi'><tr id='eR1zi'><dt id='eR1zi'><q id='eR1zi'><span id='eR1zi'><b id='eR1zi'><form id='eR1zi'><ins id='eR1zi'></ins><ul id='eR1zi'></ul><sub id='eR1zi'></sub></form><legend id='eR1zi'></legend><bdo id='eR1zi'><pre id='eR1zi'><center id='eR1zi'></center></pre></bdo></b><th id='eR1zi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eR1zi'><tfoot id='eR1zi'></tfoot><dl id='eR1zi'><fieldset id='eR1zi'></fieldset></dl></div>

      1. Android 阻止藍牙配對對話框

        Android Prevent Bluetooth Pairing Dialog(Android 阻止藍牙配對對話框)
        • <i id='fJ5sn'><tr id='fJ5sn'><dt id='fJ5sn'><q id='fJ5sn'><span id='fJ5sn'><b id='fJ5sn'><form id='fJ5sn'><ins id='fJ5sn'></ins><ul id='fJ5sn'></ul><sub id='fJ5sn'></sub></form><legend id='fJ5sn'></legend><bdo id='fJ5sn'><pre id='fJ5sn'><center id='fJ5sn'></center></pre></bdo></b><th id='fJ5sn'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fJ5sn'><tfoot id='fJ5sn'></tfoot><dl id='fJ5sn'><fieldset id='fJ5sn'></fieldset></dl></div>

            <bdo id='fJ5sn'></bdo><ul id='fJ5sn'></ul>

              1. <small id='fJ5sn'></small><noframes id='fJ5sn'>

                  <legend id='fJ5sn'><style id='fJ5sn'><dir id='fJ5sn'><q id='fJ5sn'></q></dir></style></legend>
                    <tbody id='fJ5sn'></tbody>

                  <tfoot id='fJ5sn'></tfoot>

                  本文介紹了Android 阻止藍牙配對對話框的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在開發一個使用藍牙進行打印的內部應用程序.我希望在沒有用戶輸入的情況下進行藍牙配對.我設法通過捕獲 android.bluetooth.device.action.PAIRING_REQUEST 廣播來使其正常工作.

                  I'm developing an internal application which uses Bluetooth for printing. I want the Bluetooth pairing to occur without user input. I have managed to get that working by trapping the android.bluetooth.device.action.PAIRING_REQUEST broadcast.

                  在我的廣播接收器中,我調用了 setPin 方法,配對工作正常,但 BluetoothPairingDialog 顯示一兩秒,然后消失 - 請參閱下面的鏈接.

                  In my broadcast receiver I call the setPin method, and pairing works ok, but a BluetoothPairingDialog is displayed for a second or two, then it disappears - see link below.

                  https://github.com/android/platform_packages_apps_settings/blob/master/src/com/android/settings/bluetooth/BluetoothPairingDialog.java

                  由于廣播是無序的,我無法調用 abortBroadcast(),并且想知道是否有任何其他方法可以防止出現配對對話框.我可以通過某種方式連接到窗口管理器嗎?

                  Since the broadcast is non-ordered, I can't call abortBroadcast(), and was wondering if there was any other way to prevent the pairing dialog from appearing. Can I hook into the window manager in some way?

                  推薦答案

                  老實說,我無法在不修改 sdk 的情況下想出一個方法來做到這一點.如果您是 OEM,這很容易(我使用的是 4.3):

                  I honestly haven't been able to come up with a way to do this without modifying the sdk. If you're the OEM, it's easy (I'm on 4.3):

                  在 packages/apps/Settings/AndroidManifest.xml 中,注釋配對對話框的意圖過濾器:

                  In packages/apps/Settings/AndroidManifest.xml, comment the intent filter for the pairing dialog:

                  <activity android:name=".bluetooth.BluetoothPairingDialog"
                            android:label="@string/bluetooth_pairing_request"
                            android:excludeFromRecents="true"
                            android:theme="@*android:style/Theme.Holo.Dialog.Alert">
                      <!-- <intent-filter>
                          <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
                          <category android:name="android.intent.category.DEFAULT" />
                      </intent-filter> -->
                  </activity>
                  

                  在 frameworks/base/core/java/android/bluetooth/BluetoothDevice.java 中,從此常量中移除 @hide javadoc 注釋

                  In frameworks/base/core/java/android/bluetooth/BluetoothDevice.java remove the @hide javadoc annotation from this constant

                  @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
                  public static final String ACTION_PAIRING_REQUEST =
                          "android.bluetooth.device.action.PAIRING_REQUEST";
                  

                  還有這個方法

                  public boolean setPairingConfirmation(boolean confirm) 
                  

                  然后為 BluetoothDevice.PAIRING_REQUEST 操作注冊您自己的活動或廣播接收器.此廣播接收器允許在無需用戶輸入的情況下繼續配對(僅在不需要 pin 時):

                  Then register your own activity or broadcast receiver for the BluetoothDevice.PAIRING_REQUEST action. This broadcast receiver allows pairing to continue without user input (only if no pin is required):

                  @Override
                  public void onReceive(Context context, Intent intent) {    
                     if( intent.getAction().equals(BluetoothDevice.ACTION_PAIRING_REQUEST) ) {
                        BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                        device.setPairingConfirmation( true );
                     }
                  }
                  

                  您需要重建 sdk 并針對新版本編譯代碼以訪問常量和方法,并替換/system 分區上的 Settings.apk 以禁用對話框.您可能還需要作為系統應用程序運行,但我認為可能不需要.

                  You'll need to rebuild the sdk and compile your code against the new version to get access to the constant and methods, and replace Settings.apk on the /system partition to disable the dialog. You may possibly also need to be running as a system app but I think likely not.

                  這篇關于Android 阻止藍牙配對對話框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                  Get current location during app launch(在應用啟動期間獲取當前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

                  • <tfoot id='PY82W'></tfoot>
                  • <legend id='PY82W'><style id='PY82W'><dir id='PY82W'><q id='PY82W'></q></dir></style></legend>

                      <small id='PY82W'></small><noframes id='PY82W'>

                      • <bdo id='PY82W'></bdo><ul id='PY82W'></ul>
                          <tbody id='PY82W'></tbody>

                          <i id='PY82W'><tr id='PY82W'><dt id='PY82W'><q id='PY82W'><span id='PY82W'><b id='PY82W'><form id='PY82W'><ins id='PY82W'></ins><ul id='PY82W'></ul><sub id='PY82W'></sub></form><legend id='PY82W'></legend><bdo id='PY82W'><pre id='PY82W'><center id='PY82W'></center></pre></bdo></b><th id='PY82W'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PY82W'><tfoot id='PY82W'></tfoot><dl id='PY82W'><fieldset id='PY82W'></fieldset></dl></div>
                            主站蜘蛛池模板: 香蕉一区 | 国产精品入口 | 九九九久久国产免费 | 91精品国产91久久久久久吃药 | 亚洲激情专区 | 日本一区二区三区在线观看 | 在线观看视频一区二区三区 | 精品美女在线观看 | 国产精品小视频在线观看 | 99re在线视频 | 成人网在线 | 你懂的在线视频播放 | 最新中文字幕在线 | 久国产| 久久精品99国产精品 | 中文字幕一区在线观看视频 | 国产精品国产精品国产专区不片 | 欧美日韩亚洲国产 | 久久新 | 欧美精品一二区 | 国产第一页在线播放 | 亚洲欧洲国产视频 | 成人国产午夜在线观看 | 国产精品a久久久久 | 国产精品美女一区二区三区 | 天天曰夜夜操 | 亚洲一区视频在线 | 91福利电影在线观看 | 日本欧美大片 | 日韩精品在线播放 | 国产电影一区 | 九七午夜剧场福利写真 | 狠狠爱综合网 | 亚洲网站在线观看 | 亚洲成人99| 久久久久久久久久一区二区 | 欧美视频精品 | 日一区二区 | 狠狠色香婷婷久久亚洲精品 | 国产性生活一级片 | 午夜视频在线观看视频 |