Thanks for the suggestion JohnC, that's not really what the problem is, when the back key is pressed the activity is destroyed, and when the PTT button is pressed it is instant. Not so when the home key is pressed, and I have even put activity.finish in the activity_pause if userclosed is false.It sounds to me like the system (or some app like the launcher) is waiting to see if the user is going to do a double-tap of the home button before it decides what action to initiate because that device may offer the ability to do one action with a single tap of the home button, and a completely different action if it's double-tapped.
So, the delay is to give the user time to do that double-tap.
The activity should actually start quicker if it wasn't destroyed. However the issue is probably related to the launcher behavior.
Shot in the dark: try to add this code to Activity_Pause https://www.b4x.com/android/forum/threads/clear-back-history.78129/#post-495126
so the debug log activity create/resume appear in the ide with a delay after 3 seconds?The above is generally true when the user press's the back key, however when the home key is pressed, that is a 3 second delay before the app pop's up.
so the debug log activity create/resume appear in the ide with a delay after 3 seconds?
** Receiver (svc_intents) OnReceive **
*** Service (svc_intents) Create ***
** Service (svc_intents) Start **
05/10/2019 13:32:51.539 - Atlas PTT - svc_intents(), Service_Start, INTENT com.sonim.intent.action.PTT_KEY_DOWN
05/10/2019 13:32:51.544 - Atlas PTT - svc_intents(), ACTION com.sonim.intent.action.PTT_KEY_DOWN, Main.APPSET.main_running=false
05/10/2019 13:32:51.548 - Atlas PTT - svc_intents(), StartActivity(svc_service) <- Starting Main from a service, tried this to see if it would improve performance, it did'nt
** Service (svc_intents) Destroy **
05/10/2019 13:32:51.641 - Atlas PTT - svc_intents(), Service_Destroy
05/10/2019 13:32:51.709 - Atlas PTT - svc_service(), starting main, startMain = true
** Activity (main) Create, isFirst = false **
05/10/2019 13:32:53.560 - Atlas PTT - mod_functions(), set_ShowWhenLocked
05/10/2019 13:32:53.565 - Atlas PTT - Activity_Create, FirstTime false
** Activity (main) Resume **
05/10/2019 13:32:53.569 - Atlas PTT - mod_functions(), set_ShowWhenLocked
05/10/2019 13:32:53.574 - Atlas PTT - Activity_Resume
05/10/2019 13:32:53.944 - Atlas PTT - svc_data(), sendMessage, PTT_KEY_DOWN
05/10/2019 13:32:54.022 - Atlas PTT - svc_data(), TextMessageReceived, text=PTT_KEY_DOWN_OK, fromContact=353168070000144
05/10/2019 13:32:54.378 - Atlas PTT - svc_data(), SendAudio
** Receiver (svc_intents) OnReceive **
*** Service (svc_intents) Create ***
** Service (svc_intents) Start **
05/10/2019 13:32:54.788 - Atlas PTT - svc_intents(), Service_Start, INTENT com.sonim.intent.action.PTT_KEY_UP
05/10/2019 13:32:54.791 - Atlas PTT - svc_intents(), ACTION com.sonim.intent.action.PTT_KEY_UP, Main.APPSET.main_running=true
** Service (svc_intents) Destroy **
05/10/2019 13:32:54.889 - Atlas PTT - svc_intents(), Service_Destroy
05/10/2019 13:32:54.985 - Atlas PTT - svc_data(), sendMessage, PTT_KEY_UP
05/10/2019 13:32:54.990 - Atlas PTT - svc_data(), StopSendingAudio
** Receiver (svc_watchdog) OnReceive **
*** Service (svc_watchdog) Create ***
** Service (svc_watchdog) Start **
05/10/2019 13:33:36.388 - Atlas PTT - svc_watchdog(), schedulecallback, API = 22, call back @ = 13:34:36
05/10/2019 13:33:36.393 - Atlas PTT - svc_watchdog(), call back using StartServiceAtExact()
** Service (svc_watchdog) Destroy **
** Receiver (svc_intents) OnReceive **
*** Service (svc_intents) Create ***
** Service (svc_intents) Start **
05/10/2019 13:33:36.407 - Atlas PTT - svc_intents(), Service_Start, INTENT com.sonim.intent.action.PTT_KEY_DOWN
05/10/2019 13:33:36.412 - Atlas PTT - svc_intents(), ACTION com.sonim.intent.action.PTT_KEY_DOWN, Main.APPSET.main_running=false
05/10/2019 13:33:36.415 - Atlas PTT - svc_intents(), StartActivity(Main)
** Activity (main) Create, isFirst = false **
05/10/2019 13:33:36.507 - Atlas PTT - mod_functions(), set_ShowWhenLocked
05/10/2019 13:33:36.511 - Atlas PTT - Activity_Create, FirstTime false
** Activity (main) Resume **
05/10/2019 13:33:36.517 - Atlas PTT - mod_functions(), set_ShowWhenLocked
05/10/2019 13:33:36.521 - Atlas PTT - Activity_Resume
** Service (svc_intents) Destroy **
05/10/2019 13:33:36.732 - Atlas PTT - svc_intents(), Service_Destroy
05/10/2019 13:33:36.970 - Atlas PTT - svc_data(), sendMessage, PTT_KEY_DOWN
05/10/2019 13:33:37.034 - Atlas PTT - svc_data(), TextMessageReceived, text=PTT_KEY_DOWN_OK, fromContact=353168070000144
05/10/2019 13:33:37.392 - Atlas PTT - svc_data(), SendAudio
** Receiver (svc_intents) OnReceive **
*** Service (svc_intents) Create ***
** Service (svc_intents) Start **
05/10/2019 13:33:37.841 - Atlas PTT - svc_intents(), Service_Start, INTENT com.sonim.intent.action.PTT_KEY_UP
05/10/2019 13:33:37.848 - Atlas PTT - svc_intents(), ACTION com.sonim.intent.action.PTT_KEY_UP, Main.APPSET.main_running=true
** Service (svc_intents) Destroy **
05/10/2019 13:33:37.941 - Atlas PTT - svc_intents(), Service_Destroy
05/10/2019 13:33:37.989 - Atlas PTT - svc_data(), sendMessage, PTT_KEY_UP
05/10/2019 13:33:37.993 - Atlas PTT - svc_data(), StopSendingAudio
what happens here in svc_service?05/10/2019 13:32:51.709 - Atlas PTT - svc_service(), starting main, startMain = true
** Activity (main) Create, isFirst = false **
05/10/2019 13:32:53.560 - Atlas PTT - mod_functions(), set_ShowWhenLocked
this looks like a long delay
what happens here in svc_service?
if you add a log with time stamp in main activity create
it match this time then?
** Activity (main) Create, isFirst = false **
05/10/2019 13:32:53.560 - Atlas PTT - mod_functions(), set_ShowWhenLocked
If not(UserClosed) Then
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finish", Null)
End If
Is that not the same as just doingme to do this in activity_pause
If Not(UserClosed) Then Activity.Finish
If Not(UserClosed) Then ExitApplication
Public Sub ExitApplication2
Dim jo As JavaObject
jo.InitializeStatic("android.os.Build.VERSION")
If jo.GetField("SDK_INT")>15 Then
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAffinity", Null)
Else
ExitApplication
End If
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?