Serial port on android phone

I am having problem with serial ports on my android phone. In Unity editor everything works fine.
First I am getting list of all serial ports, then i connect to the one i need and i get data from it.
Now when i export my app to android phone, i get following error:

I thought it might be problem with bluetooth permission, i added it in my android manifest but it doesnt get rid of the error.

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jj.ll" xmlns:tools="http://schemas.android.com/tools" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
  <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false" android:isGame="true" android:banner="@drawable/app_banner">
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
  </application>

And this is my c# code for getting serial port names.

using UnityEngine;
using System.Collections;
using System.IO.Ports;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Text.RegularExpressions;
public class DataGathering : MonoBehaviour {   
string[] ports;
        void Start () {
        lastDigits = new List <string>();
        checkArray = new List <string>();   
        ports = new string[10];
        filePath = Application.persistentDataPath;   
       
        ports = SerialPort.GetPortNames();
        for(var k = 0; k < ports.Length; k++)
        {
            Debug.Log(ports[k]);
        }
        /*if(GameObject.Find("Info")!=null)
        {
            subjectID = int.Parse(GameObject.Find("Info").transform.GetChild(1).name);
            testID = int.Parse(GameObject.Find("Info").transform.GetChild(0).name);
        }
        if(File.Exists(filePath+""+subjectID+"_"+testID+".txt"))
        {
            File.Delete(filePath+""+subjectID+"_"+testID+".txt");
        }
        writer = new StreamWriter(filePath+""+subjectID+"_"+testID+".txt", true);*/
    }

Hey there, did you manage to solve your problem? I am trying a similar thing.

I’m also getting a permission denied error when trying to connect to the serial interface in android. I GetPortNames(), find that the USB connected to my phone (an arduino) is under /dev/ttyACM0, but when I try to open that port it says “permission denied”.

If I run a terminal emulator app with this command: ls -l /dev/ttyACM*
I see that I have permission denied on all.

How the heck do you fix this? Do I need to root the phone to be able to change anything and communicate via USB?

I’m having a similar issue. Was there ever a resolution to this?