Android Question sending message to waiting queue (CallSubDelayed - BattChgd)

Derek Johnson

Active Member
Licensed User
I'm getting these events in the log of my app

sending message to waiting queue (CallSubDelayed - BattChgd)

and

Ignoring event (too many queued events: CallSubDelayed - BattChgd)
The App is running on a Lenovo TB-7104F using Android 8.1.0 (Go version)

It is possible that the battery is low (<15%).

Is this message being created by another B4A app on the device? Any suggestions please?
 

Cableguy

Expert
Licensed User
Hard to know, you give too little information.
What libs does your app use, what is it supposed to do, can you share some code or even reproduce in a small project...
 

Derek Johnson

Active Member
Licensed User
Here's some more info:

These are the libraries used by the App:

upload_2019-5-1_18-44-39.png


It's a Speech To Text App using the android.speech.SpeechRecognizer

This is the initialisation module:

B4X:
Sub StartRecognizer()
    TLogcolor("Step 2 ==== StartRecognizer ====",Colors.Blue)
    TLogcolor("Listenstate was " & Starter.ListenState,ColorByName.Green_DarkGreen)

    SpeechRecognizer.InitializeStatic("android.speech.SpeechRecognizer")
    JO = SpeechRecognizer.RunMethod("createSpeechRecognizer",Array(JO.InitializeContext))
    
    If Not(IsRecognitionAvailable) Then
        TLog("Speech Recognition Not Available")
        EText1.Text = "Speech Recognition Not Available"
        Return
    End If
    
    'try to get list of languages here
    'Maybe
    Dim Language As String ="en-UK"
    Try
        Language=PM.GetString("Language")
    Catch
        TLog(LastException)
        Language="en-UK"
    End Try
    Try
        Starter.PreferOffline=PM.GetBoolean("PreferOffline")
    Catch
        TLog(LastException)
    End Try
    
    'UpdateOnlineStatus
    
    TLogcolor("Recognition Language was " & Language,ColorByName.Blue_RoyalBlue)

    RecognizerIntent.Initialize("android.speech.action.RECOGNIZE_SPEECH",Null)
    RecognizerIntent.PutExtra("android.speech.extra.LANGUAGE_PREFERENCE",Language)
    RecognizerIntent.PutExtra("calling_package",Application.PackageName)
    RecognizerIntent.PutExtra("android.speech.extra.LANGUAGE_MODEL","free_form")
    RecognizerIntent.PutExtra("android.speech.extra.PARTIAL_RESULTS",True)
    RecognizerIntent.PutExtra("android.speech.extra.MAX_RESULTS",3) 'was 3

    TLog("Working Offline ====> " & Starter.PreferOffline)
    RecognizerIntent.PutExtra("android.speech.extra.PREFER_OFFLINE", Starter.PreferOffline)

    
'    RecognizerIntent.PutExtra("android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS", 1000)
'    RecognizerIntent.PutExtra("android.speech.extras.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS", 2000)
'    RecognizerIntent.PutExtra("android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS", 1000 * 10)
    
    
    TLogcolor("    Creating Starting intent",ColorByName.Yellow_DarkGoldenrod)
    Dim Event As Object = JO.CreateEvent("android.speech.RecognitionListener","Received","")
    JO.RunMethod("setRecognitionListener",Array(Event))
    Initialized = True
    
    If Starter.ListenState="Destroyed"  Or Starter.ListenState="Cancelled" Then
        StartListening
    End If
    Starter.ListenState="Init"
    HiddenEdit.RequestFocus
    'Starter.Message="Restart ===>" & Starter.Message
    TLog(" ===== Start Recogniser complete =====")
    TLog("Initialise SpeechRecognition: IsListening " & Starter.IsListening)

End Sub
 

Derek Johnson

Active Member
Licensed User
It might be coming from a different B4A app. This is not an event raised by any of the internal libraries.

Kill your app and see if it is still coming. If you are using USB debug mode then you can monitor the logs with adb logcat. It will include the package name with the message.
Yes thanks. I'll try doing that, I've got at least one other App installed that was written with B4A. If so, it must have been running in the background though.

UPDATE: Found the App generating the messages by looking at the logs with the Basic4Android Log viewer.

As a matter of interest, is there an easy way to tell if an installed App was written in B4A?
 
Last edited:
Top