microg / UnifiedNlp

Alternative network location provider for Android, with plugin interface to easily integrate third-party location providers.
978 stars 210 forks source link

API: Add helper classes #14

Closed mar-v-in closed 9 years ago

mar-v-in commented 9 years ago

Helpers for WiFi and cell tower retrieval as well as location combination.

n76 commented 9 years ago

There is a helper for averaging location records. I find that I get a little better location if I do a weighted average of the location records with the weighting based on estimated coverage range of the cell tower or WiFi AP. I have basically duplicated that logic in both of the backends that I've written. I might be nice to move that to your helper class(es).

Something like that might also allow using cell tower and wifi AP information together. So instead of returning a single location record the backend could return a list of location records with the averaging (weighted or otherwise) done for all records from all backends.

On a separate note, if the helper classes are extended can you add a query for determining the version? Not sure how it would work but something so that a backend that relies on an enhanced helper class could avoid running on a phone with an older version of the unified NLP.

mar-v-in commented 9 years ago

Something like that might also allow using cell tower and wifi AP information together. So instead of returning a single location record the backend could return a list of location records with the averaging (weighted or otherwise) done for all records from all backends.

I most cases this is not that useful. Usually you will have two backends (one for GSM and one for WiFi) and any kind of averaging does not make sense as WiFi is usually much more accurate than GSM. The "perfect" behavior for this setup is to completely ignore the GSM location if a WiFi location is available. Combining backend locations is not easy and highly depends on the backend's resolution, accuracy and confidentiality and for this reason, I think it's best to give a powerful backend combination system into users hands (allow them to say "request location using Mozilla, if accuracy is worse than 100m, ask Apple and average it with Mozilla if it's accuracy is better than 50m, if both do not provide any results at all use the local gsm database and if that does not succeed ask opencellid online"). We already had some notes about this is #5.

On a separate note, if the helper classes are extended can you add a query for determining the version?

The API library is compiled into the backend APK, which means that the API library used when compiling is always the one used at runtime. However it might be interesting to know which API version is used on the system side and which is the UnifiedNlp version used. This could be done as an API extension without breaking compatibility thanks to AIDL, so I guess I'll add this feature as well.

mar-v-in commented 9 years ago

Moved into new sub-repo. microg/android_external_UnifiedNlpApi#1