protected static String getDeviceName() {
        try {
            if (WonderPush.getApplicationContext().getPackageManager().checkPermission(android.Manifest.permission.BLUETOOTH, WonderPush.getApplicationContext().getPackageName()) == PackageManager.PERMISSION_GRANTED) {
                BluetoothAdapter btDevice = BluetoothAdapter.getDefaultAdapter();
                return btDevice.getName();
            }
        } catch (Exception ex) {
            // Ignore
        }
        return null;
    }
protected static String getDeviceName ( ) { try { if ( WonderPush . getApplicationContext ( ) . getPackageManager ( ) . checkPermission ( android . Manifest . permission . BLUETOOTH , WonderPush . getApplicationContext ( ) . getPackageName ( ) ) == PackageManager . PERMISSION_GRANTED ) { BluetoothAdapter btDevice = BluetoothAdapter . getDefaultAdapter ( ) ; return btDevice . getName ( ) ; } } catch ( Exception ex ) { } return null ; }
Returns the Bluetooth device name, if permissions are granted,
and provided the device actually has Bluetooth.