andreynovikov / trekarta

Simple, responsive map for your trek. You decide how to journey today, not the application!
https://trekarta.info
GNU General Public License v3.0
174 stars 25 forks source link

Improve energy efficiency by applying Cache Energy Pattern #127

Closed anasofiagribeiro closed 3 years ago

anasofiagribeiro commented 4 years ago

This improves the energy efficiency of andreynovikov by applying the Cache Energy Pattern for mobile applications.

The energy pattern was applied in LocationService.java and AndroidManifest.xml (for the PassiveProviderLocation subpattern) and PluginEntryReceiver.java (for the CheckMetadata subpattern) . For the first one, the general idea is to avoid performing unnecessary operations by using cache mechanisms. In particular, giving priority to the usage of LocationManager.PASSIVE_PROVIDER, since it uses less energy to give a location. For the second one, the general idea for the second one is to avoid performing unnecessary operations by using cache mechanisms. In particular, the operations in method onReceive will only execute if the extra bundles changes.

hungerburg commented 3 years ago

@anasofiagribeiro The change resonates with following experience of mine: I use mulogger for tracking, still trekarta seems to start a fresh GPS scan before showing my position on the map. The change you suggest looks like it might speed that up too? Perhaps you should be clear on the rights under which your changes can be applied? If it is just another application of an already well-known pattern, even public-domain might be available, if your local law allows that.