You are reading a single comment by @charlie and its replies. Click here to read the full conversation.
  • Instead I want to control when to power on GPS or not. When reading
    the position continously I just want to power on GPS on start and
    never disable it again (until the app closes).

    If it really takes up to 15mins to get a fix its not really usable for much anyway. I assume its quicker via the android integration app. If it is draining the power quickly you kinda do want some sort of intelligent power off. Like if the person hasn't moved in a while getting a continuous fix doesn't make sense. Either way you could supply options to the manager when you initiate it.

    If the use case is to
    get a position every hour or so the myGpsManager.getFix() (as promise
    I assume?) might be ok, but if needed can be written a less then 5
    minutes, no need to import a big library with maybe 100 functions that
    are unused.

    This is why you use tree shaking and don't import the entire library. The idea that because a function takes 5mins to write you shouldn't split it into a helper library for reuse makes little sense. If you are designing good code most functions shouldn't take a long time to write, something which becomes very apparent when writing unit tests. Having helper libraries allows you to have an initial implementation covered by unit tests which can be updated in future, with all projects using that lib getting the benefits of the update.

About

Avatar for charlie @charlie started