microg / NetworkLocation

Deprecated! Use UnifiedNlp --- Geolocation using wlan and gsm cells. Data provided by Apple and opencellid.org
102 stars 27 forks source link

Network Location Provider Documentation #4

Closed emdete closed 10 years ago

emdete commented 10 years ago

hi, i have some problems with the app which i would like to fix and would like to include an additional cell location provider. i wonder where i can get information about how it should work. can someone give me a url or the like to documents how a location provider should behave?

thanks&regards, michael

mar-v-in commented 10 years ago

The NetworkLocationProvider interface of android is not documented.

The best "documentation" is propably the source code of the LocationManagerService: https://github.com/android/platform_frameworks_base/blob/master/services/java/com/android/server/LocationManagerService.java

Just some general notes:

If you want to extend the μg NLP: You can add more cell/wifi location sources by implementing the generic LocationSource interface (either as LocationSource or as LocationSource, for convenience you may also want to extend the OnlineDataSource class if your location source requires data connection)

If you can describe the problems you would like to fix, i'd be glad to assist you.

emdete commented 10 years ago

i am in a very early stage of investigations, effect is that it stopps resolving to locations. i have a simple program that shows results from the different LocationManager.getLastKnownLocation(*_PROVIDER), which is null for NETWORK_PROVIDER if that happens.

one thing i wonder is how you do your development/test cycles. as the networklocationprovider must be a system app it requires rebooting the device after moving it to /system/app, right? or is there any way around it or anohter speedup?

another question i have is where i can find more information about the whole μg project (while i like the idea to get independent from google i don't like the dependency on apple). i would like to read more about the backgrounds and goals of μg - is there some information about it?

mar-v-in commented 10 years ago

Does your application request ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION only? There were problems with the latter before and I hoped to fix it with 166f9b022111fecdf4fe17589cb2608dd09ec446, but it's untested.

Since Ice Cream Sandwich you can just update the NetworkLocation app without the need to reboot using the user interface or adb install -r as long as the app ships the same signature and does not require new system permissions. The update might be reverted if you flash or update any system part from recovery

(old) XDA developers thread: http://forum.xda-developers.com/showthread.php?t=1715375 μg future pad: https://public.pad.fsfe.org/p/microg_future I also dislike the Apple dependency, but when I started NLP there were no (useable) alternatives. Today (espacially in post-snowden-era) this seems to become different, that's why i started supporting multiple data sources.

emdete commented 10 years ago

it requests both, i saw that commit, yes and adapted my app. it happens only with cell locations, it seems these get lost in the LocationCalculator somehow...

so it works if one version is in /system/app and you install new versions with adb install?

my idea was to send all available information (cell, wlan, bluetooth, ...whatever) to a server and let the server decide. this aproach would anonymise the requests if in turn apple or google is asked. it could use a well defined interface that different provider can implement and the app user can devide which one to use.

mar-v-in commented 10 years ago

so it works if one version is in /system/app and you install new versions with adb install? yes, as long as certificates match.

emdete commented 10 years ago

no, the installation location doesn't seem to be related, it was a side question to speed up dev/test cycles.

the behaviour is not deterministic. i added logging and it seems that the LocationCalculator drops the information sometimes...

mar-v-in commented 10 years ago

@emdete please create a new issue for your problem, the title "Network Location Provider Documentation" is totally misleading for that. Also enable logging (by executing setprop log.tag.nlp DEBUG in a root shell on the device and reinstalling the app without rebooting) and provide a logcat when the problems occur.