Timer control using problem

nitinb4a

Member
Licensed User
Longtime User
Hi Erel,

As per your earlier post I have declared the timer as Process Global variable.

I am using B4a timer control to save a location details of android smart phone on local Sqlite database but I am facing a problem of timer freezing or reset to 0 (re initializing again) when the mobile auto rotation mode is on and with every movement of cell phone from vertical to horizontal etc. as well as when user shift to another apps or game or go to home screen that timer also the timer in back ground apps is stuck up or hanging when user switch to timer apps then the timer resumes from beginning.

I want to run the timer in my apps all the time even though the user go to home screen or shift/switch to next apps/games or screen timeout happened or phone movement done from vertical to horizontal.
:sign0085:

How can i achieve this ? is there any sample apps available for same.

Kindly advise me !
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I am using B4a timer control to save a location details of android smart phone on local Sqlite database but I am facing a problem of timer freezing or reset to 0
You should only initialize the timer when FirstTime is True.

However in your case it sounds like you need to use a service. The service will continue to run all the time.
 

nitinb4a

Member
Licensed User
Longtime User
Hi Erel

I have initialized the timer when first time is true in Sub Activity_Create.

If FirstTime = True Then
TTime.Initialize("TTime", 1000 )
End If

But still the timer is resetting to zero or initializing from beginning with phone gravity changes or the auto rotation happens from horizontal to vertical.
 
Top