The bluetooth.getDefaultAdapter raises Warning?

Viewed 192

Im making an android and Arduino bluetooth communicator with the HC-05 Bluetooth Module. It was working till yesterday and now the basic data exchange doesn't work. The Bluetooth connection is accomplished but this warning is raised each time and I wonder if the Data Exchange isn't happening dew to this.

Error:

V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed
D/ViewRootImpl[LoginScreen]: windowFocusChanged hasFocus=false inTouchMode=true
W/Choreographer: Already have a pending vsync event.  There should only be one at a time.
D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@ee56af5[ActualMainActivity]
D/ViewRootImpl[ActualMainActivity]: windowFocusChanged hasFocus=true inTouchMode=true
D/BluetoothAdapter: java.lang.Throwable
        at android.bluetooth.BluetoothAdapter.<init>(BluetoothAdapter.java:762)
        at android.bluetooth.BluetoothAdapter.getDefaultAdapter(BluetoothAdapter.java:735)
        at com.example.pmedsensometer.SelectDeviceActivity.onCreate(SelectDeviceActivity.java:29)
        at android.app.Activity.performCreate(Activity.java:8006)
        at android.app.Activity.performCreate(Activity.java:7990)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3584)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:233)
        at android.app.ActivityThread.main(ActivityThread.java:8010)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
W/BluetoothAdapter: getBluetoothService(), client: android.bluetooth.BluetoothDevice$1@63edcb6
D/ViewRootImpl: support adaptive color gamut feature!
V/ViewRootImpl: The specified message queue synchronization  barrier token has not been posted or has already been removed

Code for Select Device Activity Class:

    package com.example.pmedsensometer;

    import static android.bluetooth.BluetoothAdapter.getDefaultAdapter;
    import androidx.appcompat.app.AppCompatActivity;
    import androidx.recyclerview.widget.LinearLayoutManager;

    import androidx.recyclerview.widget.RecyclerView;

    import android.annotation.SuppressLint;

    import android.bluetooth.BluetoothAdapter;

    import android.bluetooth.BluetoothDevice;

    import android.os.Bundle;

    import java.util.ArrayList;

    import java.util.List;

    import java.util.Set;

    public class SelectDeviceActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select_device);

        // Instantiate RecyclerView
        RecyclerView recyclerView = findViewById(R.id.deviceList);

        // Initialize Bluetooth adapter
        BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

        // Fetch the list from Android device's cache
        Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
        List<Object> deviceList = new ArrayList<>();
        for (BluetoothDevice device : pairedDevices){
            String deviceName = device.getName();
            String deviceHardwareAddress = device.getAddress();
            DeviceInfoModel deviceInfoModel = new DeviceInfoModel(deviceName,deviceHardwareAddress);
            deviceList.add(deviceInfoModel);
        }

        // Setting Up RecyclerView
        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        // Connecting to Data Source and Content Layout
        // Data source is the list of Bluetooth devices that are paired with Android Device
        ListAdapter listAdapter = new ListAdapter(this,deviceList);
        recyclerView.setAdapter(listAdapter);
    }
}
0 Answers
Related