Android Question StartServiceAtExact vs StartServiceAt

Discussion in 'Android Questions' started by PhilipBrown, Jun 16, 2015.

  1. PhilipBrown

    PhilipBrown Active Member Licensed User

    I'm not clear on the difference between StartServiceAtExact and StartServiceAt.
    If StartServiceAt does not start at the exact time given, then when does it start?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Starting from Android 4.4, the OS may not use the exact time. The purpose is to group scheduled tasks and save battery.

    If you call StartServiceAtExact it will force it to wake the phone at the exact time.
     
    ArminKH and Peter Simpson like this.
  3. ArminKH

    ArminKH Well-Known Member

    @Erel Well,now we should use StartServiceAtExact for android > 4.4 and StartServiceAt for android < 4.4 ?
    or we can use StartServiceAtExact for all android versions?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    StartServiceAtExact behaves exactly the same as StartServiceAt on Android 4.3-.

    Whether you should use the Exact version or not depends on your app requirements.
     
    ArminKH likes this.
  5. ArminKH

    ArminKH Well-Known Member

    i am not sure that i understand exactly
    You mean we can startserviceatexact on old android version?for example android 2.3?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Yes and Yes.
     
    ArminKH likes this.
  7. Mahares

    Mahares Well-Known Member Licensed User

    I am trying to use this code:
    Code:
    StartServiceAtExact(svcDownload, Datetime.now + X ,True)
    But it generates an error:
    Error description: Undeclared variable 'startserviceatexact' is used before it was assigned any value.
    I am using a phone with OS 5.0. How do you get StartServiceAtExact to work. It is not recognized?
    Thank you
     
  8. DonManfred

    DonManfred Expert Licensed User

    StartServiceAtExact is introduced in B4A 5.0
    Which Version of B4A you are using?
     
    Mahares likes this.
Loading...