Android Question How to properly use loadLibrary

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi guys,
I managed to have a custom library (libUART.so) being directy embedded into the Android device's firmware.
I'm using that library called (UART) into my app.
My questions now are:
- to use the "embedded" library with the new device's firmware can I keep the current APP as is (so with a reference into the LibraryManager), in the hope the system prioritize the system's embedded one?
- in the case I cannot do as described in the above point, since I can face systems with the embedded library and system without it, how can I know if the system have or not the "embedded" library and so act accordingly?
All in all, how to use/reference the embedded library using loadLibrary?

At moment, this is the current use:
B4X:
Sub Class_Globals
    Private bc As ByteConverter   
    Public SerialPort As UART        ' Library by Rui Cardoso: https://www.b4x.com/android/forum/threads/gpio-and-uart.100811/#content
    
    Dim SerialPort_devPath As String = "/dev/tty1WK3"
    Dim SerialPort_eventName As String = "SerialPort"
    Dim SerialPort_baudeRate As Int = 9600
    Dim SerialPort_flags As Int = 0
    Dim bigEndian As Boolean = False
    Dim prefix As Boolean = False
    
End Sub

Public Sub Initialize   
    Try
        SerialPort.Initialize(SerialPort_eventName, SerialPort_devPath, SerialPort_baudeRate, SerialPort_flags, bigEndian, prefix)
    Catch
        LogColor("###################################################", Colors.Red)
        LogColor("# >>>>>>>>>>>>> CRASH PORTA SERIALE <<<<<<<<<<<<< #", Colors.Red)
        LogColor("###################################################", Colors.Red)
        Log(LastException)
    End Try
End Sub

Private Sub SerialPort_NewData (Buffer() As Byte)
   'Do something with the data in the Buffer
End Sub

Thank you for your answer.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…