@SuppressLint("MissingPermission")

This commit is contained in:
astatin3
2024-07-24 15:47:15 -06:00
parent 588a71763a
commit b1e8ede9ff
3 changed files with 8 additions and 0 deletions
@@ -1,5 +1,6 @@
package com.astatin3.scoutingapp2025.ui.transfer.bluetooth;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothServerSocket;
@@ -102,6 +103,7 @@ public class BluetoothReceiver {
}
}
@SuppressLint("MissingPermission")
public void startListening() throws IOException {
if(!hasBluetoothPermissions(context)){
requestBluetoothPermissions((Activity) context);
@@ -1,5 +1,6 @@
package com.astatin3.scoutingapp2025.ui.transfer.bluetooth;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -96,6 +97,7 @@ public class BluetoothSender {
}
}
@SuppressLint("MissingPermission")
public Set<BluetoothDevice> getPairedDevices() {
if(!hasBluetoothPermissions(context)){
requestBluetoothPermissions((Activity) context);
@@ -104,6 +106,7 @@ public class BluetoothSender {
return bluetoothAdapter.getBondedDevices();
}
@SuppressLint("MissingPermission")
public void connectToDevice(BluetoothDevice device) throws IOException {
if(!hasBluetoothPermissions(context)){
requestBluetoothPermissions((Activity) context);
@@ -1,5 +1,6 @@
package com.astatin3.scoutingapp2025.ui.transfer.bluetooth;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.util.AttributeSet;
@@ -62,6 +63,7 @@ public class BluetoothSenderView extends LinearLayout {
}
deviceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@SuppressLint("MissingPermission")
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
BluetoothDevice selectedDevice = deviceList.get(position);
@@ -83,6 +85,7 @@ public class BluetoothSenderView extends LinearLayout {
});
}
@SuppressLint("MissingPermission")
private void listPairedDevices() {
Set<BluetoothDevice> pairedDevices = bluetoothSender.getPairedDevices();
if (pairedDevices != null && !pairedDevices.isEmpty()) {