Android Question (RESOLVE) sending message to waiting queue of uninitialized activity (submitjob)

fishwolf

Well-Known Member
Licensed User
Longtime User
I have a simple form with a input text field

when/where i can check the value of field for start with other functions.

if i check in create function i have this warning and app is blocked

warning log:
sending message to waiting queue of uninitialized activity (submitjob)
 

fishwolf

Well-Known Member
Licensed User
Longtime User
L'ho provato con questo codice e sembra funzionare:
[codice]
StartReceiver(HttpUtils2Service)
Fai mentre HttpUtils2Service.TempFolder = ""
Dormire(100)
Ciclo continuo
Dim GetJson come HttpJob
GetJson.Initialize("GetProfile", Me)
GetJson.Scarica("https://dummyjson.com/products/1")
[/codice]
Sì, but app wait about 20-30 seconds

Activity4 have this solution
 

Attachments

  • HttpProblem.v3.zip
    18.8 KB · Views: 132
Last edited:
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
Activity_Resume pseudo-code:
B4X:
Sub Activity_Resume
   If EditEmail.Text.Length = 0 Then
       'Check if user is already logged in via stackoverflow post
       'If yes, assign email to EditEmail.Text
       'If no, fire up intent
   End If
   If EditMail.Text.Length <> 0 Then
      ' Process regular code
   End If
End
i think that activity3 have all suggestions, but doesn't work fine
 

Attachments

  • HttpProblem.v3.zip
    18.8 KB · Views: 142
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Ok, I don't think this is a B4A issue. It's solvable (see Activity5 of the attached project), but it's not B4A that's the problem/causing the problem. When using Activity1 through Activity4 (only one of them) for the first time after installing the app, if you look at the unfiltered logs (uncheck the filtered check box), the first time an account is picked (even canceled), the phone goes nuts. Google is doing some sort of service-oriented processing that delays the starting of your application's service. Why? Ask Google. Once that is done and your app responds, try the process again (just re-pick) and notice almost no processing going on after picking the account a second time. The workaround is to start the service BEFORE launching the intent to pick an account. At that point, no looping is needed. Please note that this solution doesn't stop the phone from going nuts after selecting the account for the first time right after an install, it just ensures that the service is already up and running before the phone loses its collective mind and your app just keeps working happily as if nothing is going on.

B4X:
        StartReceiver(HttpUtils2Service) ' If you do this before firing up the account manager, the application proceeds without issues
        jo.InitializeStatic("android.accounts.AccountManager")
        GetAccounts_StartActivityForResult(jo.RunMethod("newChooseAccountIntent", Array(Null, Null, Array As String("com.google"), Null, Null, Null, Null)))
                
        Wait For ion_Event (MethodName As String, Args() As Object)
        If -1 = Args(0) Then 'resultCode = RESULT_OK
            Dim i As Intent = Args(1)
            Log("Account=" & i.GetExtra("authAccount"))
            EditEmail.text = i.GetExtra("authAccount")
        End If

This should take care of this issue
 

Attachments

  • HttpProblem.v4.zip
    29 KB · Views: 139
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
i think that activity3 have all suggestions, but doesn't work

Ok, I don't think this is a B4A issue. It's solvable (see Activity5 of the attached project), but it's not B4A that's the problem/causing the problem. When using Activity1 through Activity4 (only one of them) for the first time after installing the app, if you look at the unfiltered logs (uncheck the filtered check box), the first time an account is picked (even canceled), the phone goes nuts. Google is doing some sort of service-oriented processing that delays the starting of your application's service. Why? Ask Google. Once that is done and your app responds, try the process again (just re-pick) and notice almost no processing going on after picking the account a second time. The workaround is to start the service BEFORE launching the intent to pick an account. At that point, no looping is needed. Please note that this solution doesn't stop the phone from going nuts after selecting the account for the first time right after an install, it just ensures that the service is already up and running before the phone loses its collective mind and your app just keeps working happily as if nothing is going on.

B4X:
        StartReceiver(HttpUtils2Service) ' If you do this before firing up the account manager, the application proceeds without issues
        jo.InitializeStatic("android.accounts.AccountManager")
        GetAccounts_StartActivityForResult(jo.RunMethod("newChooseAccountIntent", Array(Null, Null, Array As String("com.google"), Null, Null, Null, Null)))
               
        Wait For ion_Event (MethodName As String, Args() As Object)
        If -1 = Args(0) Then 'resultCode = RESULT_OK
            Dim i As Intent = Args(1)
            Log("Account=" & i.GetExtra("authAccount"))
            EditEmail.text = i.GetExtra("authAccount")
        End If

This should take care of this issue
Thank you
 
Upvote 0
Top