Get local Bluetooth adapter to initialize Bluetooth - Android Bluetooth

Android examples for Bluetooth:Turn On bluetooth

Description

Get local Bluetooth adapter to initialize Bluetooth

Demo Code


//package com.java2s;

import android.bluetooth.BluetoothAdapter;

import android.content.Context;

public class Main {
    private static BluetoothAdapter mBluetoothAdapter;
    private static Context mContext;

    public static void initBluetooth(Context context) {
        // Get local Bluetooth adapter
        if (mBluetoothAdapter == null)
            mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        mContext = context;//from w  w w.ja v  a2  s.c  o m
    }
}

Related Tutorials