Page 459 - 2
P. 459

if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_FINE_L
            OCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getApplication
            Context(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                       return;
                   }

                   Log.d("BluetoothManager", " 메니저 생성됨");
                   locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_S
            ERVICE);


                   LocationListener locationListener = new LocationListener() {
                       @Override
                       public void onLocationChanged(Location location) {
                          GPS_Speed = String.format("%1.0f", location.getSpeed() * 3.6);
                       }

                       @Override
                       { //  나머지 생략 }
                   };
                   Log.d("BluetoothManager", " 리스너생성");

                   locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10, 0, locationListener);
                   Log.d("BluetoothManager", "GPS  업데이트 완료");
               }

               public class Bluetooth_Manager {


                   //Bluetooth Device
                   private BluetoothDevice mdevice = null;


                   //BluetoothSocket
                   public BluetoothSocket mmSocket;


                   //UUID  생성
                   UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");

                   //Stream
                   OutputStream mmOutStream;
                   ObjectOutputStream oout;


                   Message toast = new Message();

                   public Bluetooth_Manager() {
                       SettingBluetooth();
                       toast.what = TOAST_MESSAGE;
                       new Thread(new Runnable() {
                          @Override
                          public void run() {
                              while (mmSocket.isConnected()) {
                                 try {


                                                         - 459 -
   454   455   456   457   458   459   460   461   462   463   464