package com.example.mwismer.mobproto_finalproject;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by mwismer on 10/23/14.
 */
public class MyFragment extends Fragment{
    public MyFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_my, container, false);
        return rootView;
    }
}

@@ -93,17 +93,191 @@
 oid.
-os.Bundle
+bluetooth.BluetoothAdapter;%0Aimport android.bluetooth.BluetoothManager;%0Aimport android.content.Context;%0Aimport android.content.Intent;%0Aimport android.os.Bundle;%0Aimport android.util.Log
 ;%0Aim
@@ -453,16 +453,98 @@
 agment%7B%0A
+    private String TAG = %22MyFragment%22;%0A    private BluetoothAdapter mBLEAdapter;%0A%0A
     publ
@@ -711,24 +711,24 @@
 nceState) %7B%0A
-
         View
@@ -797,16 +797,491 @@
 false);%0A
+        final BluetoothManager bluetoothManager =%0A                (BluetoothManager) getActivity().getSystemService(Context.BLUETOOTH_SERVICE);%0A        mBLEAdapter = bluetoothManager.getAdapter();%0A        if (mBLEAdapter == null %7C%7C !mBLEAdapter.isEnabled()) %7B%0A            Log.d(TAG, %22Enabling Bluetooth%22);%0A            Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);%0A            getActivity().startActivityForResult(enableBtIntent, 20);%0A        %7D%0A%0A
         

Enable Bluetooth if not already enabled