mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
@SuppressLint("MissingPermission")
This commit is contained in:
+2
@@ -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);
|
||||
|
||||
+3
@@ -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);
|
||||
|
||||
+3
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user