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.
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