Android Question Ignoring event (too many queued events: astream_newdata)

Graham

Member
Licensed User
Longtime User
I am reading in BT data. All is good until I start another library that uses this data. I send the BT data through a library that parses out the GPS data and then updates a MAP. If I don't call the library to display on the map all is good. But when I call the library to display the MAP, it dies. After about ten seconds I get the following in the Logcat. Any ideas?

sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
'''''''''''''''''''''''''Here is when the problem starts and it doesn't seem to recover''''''''''''''''''''''
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
 

Graham

Member
Licensed User
Longtime User
Am I on the right track by either needing to do Service.startforeground or
#StartCommandReturnValue: android.app.Service.START_STICKY?
 
Upvote 0

Dario126

Member
Licensed User
Longtime User
Have You found root cause for this ??

I have similar problem. I'm using Erel's example code (slightly modified).
This code is running within single activity (BT connection is done within Main activity).

B4X:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals
    Dim AStream As AsyncStreams
End Sub

Sub Globals
    Dim txtInput As EditText
    Dim txtLog As EditText
    Dim btnSend As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("2")
    If AStream.IsInitialized = False Then
        'AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "AStream")
        AStream.Initialize(Main.serial1.InputStream, Main.serial1.OutputStream, "AStream")               
    End If
    txtLog.Width = 100%x
End Sub

Sub AStream_NewData (Buffer() As Byte)
Log("AStream_NewData")
    Dim s As String
    s = BytesToString(Buffer, 0, Buffer.Length, "UTF8")
    LogMessage("IN", s)
End Sub

Sub AStream_Error
    ToastMessageShow("Connection is broken.", True)
    ToastMessageShow(LastException.Message,True)
End Sub

Sub AStream_Terminated
    ToastMessageShow("Stream terminated", True)
    AStream_Error
End Sub

Sub Activity_Resume
   
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    'If UserClosed Then
    '    AStream.Close
    'End If
End Sub

Sub txtInput_EnterPressed
    If btnSend.Enabled = True Then btnSend_Click
End Sub


Sub btnSend_Click
    AStream.Write(txtInput.Text.GetBytes("UTF8"))
    txtInput.SelectAll
    txtInput.RequestFocus
    LogMessage("OUT", txtInput.Text)
End Sub


Sub LogMessage(From As String, Msg As String)
    txtLog.Text = txtLog.Text & From & ": " & Msg & CRLF
    txtLog.SelectionStart = txtLog.Text.Length
End Sub


and when I expect to get "US0" string from serial port I don't get anything, program even don't enter Sub AStream_NewData, because command Log("AStream_NewData") is not executed.


When I send "US0" many times from external device via bluetooth , I get this in log:

sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
Ignoring event (too many queued events: astream_newdata)
sending message to waiting queue (astream_newdata)
 
Upvote 0
Top