import android.os.Bundle;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.util.Log;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Bluetoothアダプタが利用可能か調べる
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
Log.v("タグ", "Bluetoothアダプタが利用出来ません");
}else
Log.v("タグ", "Bluetoothアダプタが利用出来ます");//
}
}
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
Bluetoothアダプタが利用できないとBluetooth機能が使えない。
0 件のコメント:
コメントを投稿