gjedeer / mylocation

Share your location on Android - with Email, SMS, Conversations, Tox, Whatsapp etc
https://f-droid.org/repository/browse/?fdid=net.mypapit.mobile.myposition
GNU General Public License v2.0
29 stars 14 forks source link

Feature: Widget or background operation #14

Open matthijskooijman opened 6 years ago

matthijskooijman commented 6 years ago

I'm planning to keep this app handy to answer "where am I?" in an emergency (e.g. when having to call an ambulance). The typical usecase would be to fire off this app to get my location, and while it searches, call the emergency services (and switch back to the app later to read the address).

However, it seems that once you switch away from the app (e.g. to start a phone call), it stops the location search and the GPS is disabled again. It would be helpful if it could continue searching in the background (perhaps with a notification that can be used to cancel?). Not sure if Android has limitations here, though?

Alternatively, having a widget that can start a search and has a cancel button might be interesting. One such app exists here:

https://play.google.com/store/apps/details?id=com.futonredemption.mylocation&hl=en https://code.google.com/archive/p/futonic-mylocationwidget/

image

That app has a few downsides:

Still, a similar feature might be useful to add to this app, possibly reusing some code from that app?

Related to this request, it would be helpful if the app would show a notification when the position is found, ideally showing the coordinates and address directly for quick reference.

gjedeer commented 6 years ago

This app used to stay in background, not intentionally: https://github.com/gjedeer/mylocation/issues/4

I have a need for a similar feature too (if you get a fix every X hours, the next fix is faster. if you don't get a fix for a long time and start an app like osmand, it takes ages before it gets a fix) so this may actually be implemented soon.

matthijskooijman commented 6 years ago

Thanks for the quick reply, would be great to see this feature.

I did just realize a workaround to use until then: I can use the other widget app to get a fix in the background, and once it has got a fix, start this app to see the detailed results (which works because this app shows the most recent results right away, which is helpful).

gjedeer commented 6 years ago

https://github.com/gjedeer/mylocation/commit/01518834acbfbc425d420865255f97a2c4cee4ec implements something like this.

Press the location button (target icon) on Action Bar - foreground service is started, looking for location Press it again - the service is stopped.

When it finds location - the service stops itself and removes notification.

It could be made better: it could show the number of satellites and tapping the notification could stop scanning. But that's for another year :)