1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Can't decrease slow warm start and slow hot start rates

Discussion in 'Android Questions' started by tufanv, Jun 26, 2019.

  1. tufanv

    tufanv Expert Licensed User

    Hello,

    My app does not have a problem with cold start, it generally starts before 5 seconds which is the optimal time according to google. But I have a problem with warm start and hot start. I have a rate of %35 percent which takes longer more than 2 seconds to get the app to foreground from background. I don't have many operations under activity_resume so what may be the reason for the app comes back to foreground so slowly ? I also do not experience any slowness when I test with my devices but it is obvious that there is a problem some where.

    Using sleep(0) on activity_resume as Erel suggested before breaks the app, it gives some views not initialized error. I don't actually understand how the warm start or hot start timer works. Is this the time when the actiivty_resume sub is completed or it is not related ?

    Suggestion are welcome.

    Thanks
     
  2. sorex

    sorex Expert Licensed User

    only create the base elements to make it appear as fast as possible and then use a timer of 10 miliseconds to init a sub to create other data.

    it's the only way I get it so fast where callsubdelayed and sleep failed for me.

    Code:
    Public Sub Initialize(act As Activity)
        createBackground
        createMenu
        
        tmrCreateData.Initialize(
    "tmrCreateData",10)
        tmrCreateData.Enabled=
    True
    End Sub

    Sub tmrCreateData_Tick
     tmrCreateData.Enabled=
    False
     createData   
    End Sub
     
    tufanv likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    No need for this timer. It will be simpler with:
    Code:
    createBackground
    createMenu
    Sleep(
    10)
    createData
     
  4. sorex

    sorex Expert Licensed User

    as written above I've tried this a few times before and it never worked.

    either the lag remains or the app freaks out.
     
  5. tufanv

    tufanv Expert Licensed User

    As you know, google changed the store algorithm which lists the app, and icrease the importance of these problems in listings. My app dropped down from an important keywrod from 2 to 14. Only problem I have is slow warm start is %37 higgher than my competitors as shown in play developer console. I cant decrease this time still after many tries.

    My app also doesnt work when I use sleep , It gives view not initalized etc.

    2) at first startup there is a time indicator in unfiltered logs but for resume of activity there is no timer how can we find the time for slow warm start ?

    3) does using sleep 1000 for some reason at activity resume increase this time by 1 second or not ?
     
    Last edited: Sep 6, 2019
  6. Erel

    Erel Administrator Staff Member Licensed User

    Resuming an activity should be very fast as the layout should already be ready. Check your code and make sure no to do anything unnecessary there.

    It will not increase.
     
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