B
B
Bogdan2019-01-08 11:55:46
Android
Bogdan, 2019-01-08 11:55:46

Serial port how to work?

Hello. Tell me please. There is an Android 4.4 device with a hardware Serial (Com) port. How can I work with this port, worked via UART

PeripheralManager manager = PeripheralManager.getInstance();
                List<String> deviceList = manager.getUartDeviceList();
                if (deviceList.isEmpty()) {
                    Log.i(TAG, "No UART port available on this device.");
                } else {
                    Log.i(TAG, "List of available devices: " + deviceList);
                }

Mistake
7736-7736/com.example.user.test_com_app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.user.test_com_app, PID: 7736
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/things/pio/PeripheralManager;
        at com.example.user.test_com_app.TestComFragment$1.onClick(TestComFragment.java:45)
        at android.view.View.performClick(View.java:6597)
        at android.view.View.performClickInternal(View.java:6574)
        at android.view.View.access$3100(View.java:778)
        at android.view.View$PerformClick.run(View.java:25885)

Here is this miracle:
5c346328c0024045757424.jpeg
Here in the settings the port is determined
5c346610def1c983145021.jpeg
Maybe there are other libraries for work, or how to do it right? Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aol-nnov, 2019-01-08
@aol-nnov

like a real shlimazl, he didn’t even throw an error into Google :) (and there, I must say, there is an answer on the first line!)
For example: https://stackoverflow.com/a/49217334

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question