Commit 041d8677 authored by YONG-LIN SU's avatar YONG-LIN SU

修正權限錯誤

parent 6b1dd5e3
...@@ -30,6 +30,9 @@ public class ConvertBindingAdapter { ...@@ -30,6 +30,9 @@ public class ConvertBindingAdapter {
public static void BlueToothStatus2String(TextView textView, BlueToothViewModel.BlueToothStatus blueToothStatus){ public static void BlueToothStatus2String(TextView textView, BlueToothViewModel.BlueToothStatus blueToothStatus){
String message = ""; String message = "";
int colorCode = Color.BLACK; int colorCode = Color.BLACK;
if(blueToothStatus == null){
blueToothStatus = BlueToothViewModel.BlueToothStatus.INIT;
}
switch (blueToothStatus){ switch (blueToothStatus){
case INIT: case INIT:
message = "尚未連接"; message = "尚未連接";
......
package ecom.android.newparkapp.view; package ecom.android.newparkapp.view;
import static android.Manifest.permission.BLUETOOTH_ADVERTISE;
import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_SCAN; import static android.Manifest.permission.BLUETOOTH_SCAN;
...@@ -79,7 +80,7 @@ public class T02StartActivity extends AppCompatActivity { ...@@ -79,7 +80,7 @@ public class T02StartActivity extends AppCompatActivity {
private ArrayAdapter<String> deviceNameArrayAdapter; private ArrayAdapter<String> deviceNameArrayAdapter;
private MutableLiveData<Boolean> hasPermissions = new MutableLiveData<>(); private MutableLiveData<Boolean> hasPermissions = new MutableLiveData<>();
private String[] bluetoothPermissions = new String[]{BLUETOOTH_CONNECT, BLUETOOTH_SCAN}; private String[] bluetoothPermissions = new String[]{BLUETOOTH_SCAN, BLUETOOTH_CONNECT, BLUETOOTH_ADVERTISE};
private ActivityResultLauncher vehicleTypeResultLauncher; private ActivityResultLauncher vehicleTypeResultLauncher;
private ActivityResultLauncher spaceResultLauncher; private ActivityResultLauncher spaceResultLauncher;
......
package ecom.android.newparkapp.viewModel; package ecom.android.newparkapp.viewModel;
import static android.Manifest.permission.BLUETOOTH_ADVERTISE;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_SCAN;
import android.app.Activity;
import android.app.Application; import android.app.Application;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment