pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="15bnfxh" 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="vvnfnpj" 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="drh7vxj" id='PY82W'><tfoot id='PY82W'></tfoot><dl id='PY82W'><fieldset id='PY82W'></fieldset></dl></div>
                            主站蜘蛛池模板: 结晶点测定仪-润滑脂滴点测定仪-大连煜烁 | 上海软件开发-上海软件公司-软件外包-企业软件定制开发公司-咏熠科技 | 聚合氯化铝厂家-聚合氯化铝铁价格-河南洁康环保科技 | 杰福伦_磁致伸缩位移传感器_线性位移传感器-意大利GEFRAN杰福伦-河南赉威液压科技有限公司 | loft装修,上海嘉定酒店式公寓装修公司—曼城装饰 | 机构创新组合设计实验台_液压实验台_气动实训台-戴育教仪厂 | 旗杆生产厂家_不锈钢锥形旗杆价格_铝合金电动旗杆-上海锥升金属科技有限公司 | 橡胶膜片,夹布膜片,橡胶隔膜密封,泵阀设备密封膜片-衡水汉丰橡塑科技公司网站 | 山东彩钢板房,山东彩钢活动房,临沂彩钢房-临沂市贵通钢结构工程有限公司 | 体检车_移动CT车_CT检查车_CT车_深圳市艾克瑞电气有限公司移动CT体检车厂家-深圳市艾克瑞电气有限公司 | 铝合金风口-玻璃钢轴流风机-玻璃钢屋顶风机-德州东润空调设备有限公司 | 热熔胶网膜|pes热熔网膜价格|eva热熔胶膜|热熔胶膜|tpu热熔胶膜厂家-苏州惠洋胶粘制品有限公司 | 火锅底料批发-串串香技术培训[川禾川调官网] | 磁力抛光机_磁力研磨机_磁力去毛刺机-冠古设备厂家|维修|租赁【官网】 | 亿立分板机_曲线_锯片式_走刀_在线式全自动_铣刀_在线V槽分板机-杭州亿协智能装备有限公司 | 液压油缸生产厂家-山东液压站-济南捷兴液压机电设备有限公司 | 成都竞价托管_抖音代运营_网站建设_成都SEM外包-成都智网创联网络科技有限公司 | POS机办理_个人POS机免费领取 - 银联POS机申请首页 | 高尔夫球杆_高尔夫果岭_高尔夫用品-深圳市新高品体育用品有限公司 | 深圳网站建设-高端企业网站开发-定制网页设计制作公司 | 吹塑加工_大型吹塑加工_滚塑代加工-莱力奇吹塑加工有限公司 | 长沙网站建设制作「网站优化推广」-网页设计公司-速马科技官网 | 权威废金属|废塑料|废纸|废铜|废钢价格|再生资源回收行情报价中心-中废网 | 工控机,嵌入式主板,工业主板,arm主板,图像采集卡,poe网卡,朗锐智科 | 东莞办公家具厂家直销-美鑫【免费3D效果图】全国办公桌/会议桌定制 | 代做标书-代写标书-专业标书文件编辑-「深圳卓越创兴公司」 | 单柱拉力机-橡胶冲片机-哑铃裁刀-江都轩宇试验机械厂 | 微水泥_硅藻泥_艺术涂料_艺术漆_艺术漆加盟-青岛泥之韵环保壁材 武汉EPS线条_EPS装饰线条_EPS构件_湖北博欧EPS线条厂家 | 润东方环保空调,冷风机,厂房车间降温设备-20年深圳环保空调生产厂家 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 纯水设备_苏州皙全超纯水设备水处理设备生产厂家 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 合肥制氮机_合肥空压机厂家_安徽真空泵-凯圣精机 | 彩超机-黑白B超机-便携兽用B超机-多普勒彩超机价格「大为彩超」厂家 | 盐水蒸发器,水洗盐设备,冷凝结晶切片机,转鼓切片机,絮凝剂加药系统-无锡瑞司恩机械有限公司 | 消泡剂_水处理消泡剂_切削液消泡剂_涂料消泡剂_有机硅消泡剂_广州中万新材料生产厂家 | HDPE土工膜,复合土工膜,防渗膜价格,土工膜厂家-山东新路通工程材料有限公司 | 包塑丝_高铁绑丝_地暖绑丝_涂塑丝_塑料皮铁丝_河北创筹金属丝网制品有限公司 | 威海防火彩钢板,威海岩棉复合板,威海彩钢瓦-文登区九龙岩棉复合板厂 | 济南ISO9000认证咨询代理公司,ISO9001认证,CMA实验室认证,ISO/TS16949认证,服务体系认证,资产管理体系认证,SC食品生产许可证- 济南创远企业管理咨询有限公司 郑州电线电缆厂家-防火|低压|低烟无卤电缆-河南明星电缆 | led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 |