Android Question [SOLVED] Timer already initialized ?

Discussion in 'Android Questions' started by lemonisdead, Apr 19, 2015.

  1. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Hello,

    Again I am seeing strange things : in a service, in Service_Create I have initialized a Timer
    While debugging, I have seen in the logs

    This turns my head on because :
    • the service was destroying itself
    • the Timer is initialized in Service_Create only
    Do I have something more to learn about components life cycles ?
    As a workaround I now test if the Timer is already initialized. But is it the right way to do things ?

    Code:
    Sub Service_Create
        
    If Not(TEnvoiSMS.IsInitialized) Then TEnvoiSMS.Initialize("TEnvoiSMS",DateTime.TicksPerSecond/4)
        LoadStuff
    End Sub
    Many thanks
     
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    The service may be destroyed but not the process.
    You can check IsInitialized.
     
    lemonisdead and Peter Simpson like this.
  3. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Edit : Sorry I have got it : it is a Process Global... Thanks again for your advice
     
  4. Peter Simpson

    Peter Simpson Expert Licensed User

    Tut tut tut lol ;)
     
    lemonisdead likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice