Page 84 - MDP2022-2
P. 84

//                                                                                    int[]  grantResults)
                                            //  to  handle  the  case  where  the  user  grants  the  permission.  See  the  do
            cumentation
                                            //  for  ActivityCompat#requestPermissions  for  more  details.

                                            return;
                                    }
                                    mBluetoothAdapter.disable();
                                    Toast.makeText(getApplicationContext(),  "블루투스가  비활성화  되었습니다.",  T
            oast.LENGTH_SHORT).show();

                                    mTvBluetoothStatus.setText("비활성화");
                            }  else  {
                                    Toast.makeText(getApplicationContext(),  "블루투스가  이미  비활성화  되어  있습
            니다.",  Toast.LENGTH_SHORT).show();
                            }
                    }



                    @Override
                    protected  void  onActivityResult(int  requestCode,  int  resultCode,  Intent  data)  {
                            switch  (requestCode)  {

                                    case  BT_REQUEST_ENABLE:
                                            if  (resultCode  ==  RESULT_OK)  {  //  블루투스  활성화를  확인을  클릭하였다
            면
                                                    Toast.makeText(getApplicationContext(),  "블루투스  활성화",  Toast.LE
            NGTH_LONG).show();
                                                    mTvBluetoothStatus.setText("활성화");

                                            }  else  if  (resultCode  ==  RESULT_CANCELED)  {  //  블루투스  활성화를  취
            소를  클릭하였다면
                                                    Toast.makeText(getApplicationContext(),  "취소",  Toast.LENGTH_LON
            G).show();

                                                    mTvBluetoothStatus.setText("비활성화");
                                            }
                                            break;
                            }
                            super.onActivityResult(requestCode,  resultCode,  data);
                    }



                    void  listPairedDevices()  {
                            if  (mBluetoothAdapter.isEnabled())  {
                                    if  (ActivityCompat.checkSelfPermission(this,  Manifest.permission.BLUETOOT

            H_CONNECT)  !=  PackageManager.PERMISSION_GRANTED)  {
                                            //  TODO:  Consider  calling
   79   80   81   82   83   84   85   86   87   88   89