當前位置: 首頁>>代碼示例>>Java>>正文


Java BluetoothAdapter.getName方法代碼示例

本文整理匯總了Java中android.bluetooth.BluetoothAdapter.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java BluetoothAdapter.getName方法的具體用法?Java BluetoothAdapter.getName怎麽用?Java BluetoothAdapter.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.bluetooth.BluetoothAdapter的用法示例。


在下文中一共展示了BluetoothAdapter.getName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: logStatus

import android.bluetooth.BluetoothAdapter; //導入方法依賴的package包/類
public void logStatus() {

            if (true) return; // NOPMD

            String message = "";
            if (service == null) {
                message = "No swap service";
            } else {
                String bluetooth = service.getBluetoothSwap().isConnected() ? "Y" : " N";
                String wifi = service.getWifiSwap().isConnected() ? "Y" : " N";
                String mdns = service.getWifiSwap().getBonjour().isConnected() ? "Y" : " N";
                message += "Swap { BT: " + bluetooth + ", WiFi: " + wifi + ", mDNS: " + mdns + "}, ";

                BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
                bluetooth = "N/A";
                if (adapter != null) {
                    Map<Integer, String> scanModes = new HashMap<>(3);
                    scanModes.put(BluetoothAdapter.SCAN_MODE_CONNECTABLE, "CON");
                    scanModes.put(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE, "CON_DISC");
                    scanModes.put(BluetoothAdapter.SCAN_MODE_NONE, "NONE");
                    bluetooth = "\"" + adapter.getName() + "\" - " + scanModes.get(adapter.getScanMode());
                }

                message += "Find { BT: " + bluetooth + ", WiFi: " + wifi + "}";
            }

            Date now = new Date();
            Utils.debugLog("Swap Status", now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + " " + message);

            new Timer().schedule(new TimerTask() {
                    @Override
                    public void run() {
                        new SwapDebug().logStatus();
                    }
                }, 1000
            );
        }
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:38,代碼來源:SwapWorkflowActivity.java

示例2: getBluetoothName

import android.bluetooth.BluetoothAdapter; //導入方法依賴的package包/類
public String getBluetoothName() {
    try {
        BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
        if (defaultAdapter != null) {
            return defaultAdapter.getName();
        }
    } catch (Throwable e) {
        Ln.e(e);
    }
    return null;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:12,代碼來源:DeviceHelper.java

示例3: getOurDeviceName

import android.bluetooth.BluetoothAdapter; //導入方法依賴的package包/類
public static String getOurDeviceName() {
    BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter();
    if (myDevice != null)
        return myDevice.getName();
    return null;
}
 
開發者ID:BloomBooks,項目名稱:BloomReader,代碼行數:7,代碼來源:BloomReaderApplication.java


注:本文中的android.bluetooth.BluetoothAdapter.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。