Code example for BluetoothAdapter

Methods: getAddress

0
            if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { 
                int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); 
                switch (state) { 
                case BluetoothAdapter.STATE_ON: 
                    Log.d(TAG, "BluetoothAdapter.STATE_ON"); 
                    mTv.setText(mAdapter.getAddress()); 
                    break; 
                } 
            } 
        } 
    }; 
 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate()");
 
        mContext = this;
        IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
        mContext.registerReceiver(mReceiver, filter);