해결좀 해주세용~~~~
package logo.test;
import android.app.Activity;
import android.bluetooth.*;
import android.content.*;
import android.os.Bundle;
import android.view.*;
import android.widget.*;
public class test extends Activity {
private static final int REQUEST_ENABLE_BT = 2;
//블루투스 어댑터를 통해서 다른 블루투스 디바이스를 찾을수 있다.
private BluetoothAdapter mBluetoothAdapter = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); //블루투스를어댑터를 얻기 위해서 getDefaultAdapter를 해야됨
if (mBluetoothAdapter == null) {
Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
finish();
return;
}
if (!mBluetoothAdapter.isEnabled()) {//블루투스 활성화 시키기요ㅋㅋㅋ
Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableIntent, REQUEST_ENABLE_BT);
}
}
}
권한은 주셨나요?