martykan / forecastie

A simple, opensource weather app for Android.
Other
868 stars 335 forks source link

London fixed when app is restarted #611

Closed initenit closed 2 years ago

initenit commented 2 years ago

When I restart the app, the weather information is fixed to London. Can I change it to current city or make some settings that people can setting the first city?

robinpaulson commented 2 years ago

Yes, it will do this already. Try the "Detect Location" feature or search for your city name.

initenit commented 2 years ago

It only works when I push the button. I want it works automatically when I start the app.

Lee-Carre commented 2 years ago

I recall the Update location in background configuration option. Might be worth checking if this is enabled in your instance, @initenit .

A sensible implementation I've encountered occasionally in other apps, is that they passively get the location, and silently self-update based on that.

Thus, battery-saving when the user is likely remaining in the same area (or otherwise unconcerned about their device knowing current location) yet uses recent location info when something else is requesting location info for other reasons.

For users who then want Forecastie (or similar-implementation apps) to always have recent info; keep the GNSS receiver enabled (such as by using mirfatif/MyLocation (available via F-Droid) ).

Edit: #529.

robinpaulson commented 2 years ago

@Lee-Carre This is really interesting, thanks. I realise now that I had a wrong interpretation of what "passive location" meant.

Lee-Carre commented 2 years ago

@robinpaulson

I had a wrong interpretation of what "passive location" meant.

As did I, in the context of Android. I was prompted to think of something like an inertial system or maybe passive sonar. Ironic that prior knowledge was a disadvantage in this case.

For what Android means by passive, then some derivative of the word ‘cached’ would have been far less ambiguous, I feel. But, alas.

Anyway; glad you found the suggestion useful.

One advantage of querying the passive provider is that you can (within reason) be less careful about interval, timeout, and accuracy. Off the top of my head:

Should be good enough for the purposes of knowing which area to request weather info for. However, adjust as you see fit.

Then can simply leave that looping in the background (or waiting to be sent an event; however the internals work), and the results are auto-magic with a lot of use-cases handled gracefully (without overly complex code or killing the battery). Everyone wins.

Lee-Carre commented 2 years ago

See also android/location-samples.