Update (API) docs
This commit is contained in:
parent
a79141c0d1
commit
f4f11abcf7
|
@ -23,9 +23,9 @@ Download `NetworkLocation.apk`, copy it to `/system/priv-app/NetworkLocation.apk
|
|||
|
||||
Usage
|
||||
-----
|
||||
UnifiedNlp as it does not provide any location provider features, but acts as a middleware for multiple backends.
|
||||
UnifiedNlp as it does not provide any features, but acts as a middleware for multiple backends.
|
||||
|
||||
Here is an open list of backends known to me:
|
||||
Here is an open list of backends for geolocation known to me:
|
||||
|
||||
- [AppleWifiNlpBackend](https://github.com/microg/AppleWifiNlpBackend) - backend that uses Apple's service to resolve wifi locations
|
||||
- [OpenWlanMapNlpBackend](https://github.com/microg/OpenWlanMapNlpBackend) - backend that uses OpenWlanMap.org to resolve user location.
|
||||
|
@ -34,6 +34,10 @@ Here is an open list of backends known to me:
|
|||
- [PersonalWifiBackend](https://github.com/n76/wifi_backend) - Local location provider for WiFi APs using on-phone generated database.
|
||||
- (...) Create issue or pull request to extend this list :)
|
||||
|
||||
The following is an open list of backends for (reverse) geocoding:
|
||||
|
||||
- [NominatimGeocoderBackend](https://github.com/microg/NominatimGeocoderService)
|
||||
|
||||
As part of a custom ROM
|
||||
-----------------------
|
||||
UnifiedNlp can be build as part of Android when building an Android ROM from source.
|
||||
|
|
|
@ -4,7 +4,7 @@ This library contains anything needed to build a backend for UnifiedNlp.
|
|||
|
||||
Writing the service
|
||||
-------------------
|
||||
### The easy way
|
||||
### The easy way (Location)
|
||||
Writing a service is fairly easy. Just create a class that extends `org.microg.nlp.api.LocationBackendService`, it provides several methods:
|
||||
|
||||
#### `update()`-method
|
||||
|
@ -23,6 +23,10 @@ This is a good place to initialize or respectively destroy whatever you need dur
|
|||
#### `report(Location)`-method
|
||||
You can call this method every time to report the given location as soon as possible.
|
||||
|
||||
### The easy way (Geocoding)
|
||||
Providing a Geocoder is even simpler than a LocationProvider. Extend `org.microg.nlp.api.GeocoderBackendService` and implement the methods `getFromLocation` and `getFromLocationName`.
|
||||
Both methods reflect a call to the corresponding method in `android.location.Geocoder`.
|
||||
|
||||
### The flexible way
|
||||
Instead of using the `LocationBackendService` helper class you can do it by hand.
|
||||
It's important that your service overrides the `onBind()` method and responds with a `Binder` to the `LocationBackend` interface.
|
||||
|
|
|
@ -20,21 +20,17 @@ public abstract class GeocoderBackendService extends AbstractBackendService {
|
|||
* address should be localized in
|
||||
* @see android.location.Geocoder#getFromLocation(double, double, int)
|
||||
*/
|
||||
protected List<Address> getFromLocation(double latitude, double longitude, int maxResults,
|
||||
String locale) {
|
||||
return null;
|
||||
}
|
||||
protected abstract List<Address> getFromLocation(double latitude, double longitude,
|
||||
int maxResults, String locale);
|
||||
|
||||
/**
|
||||
* @param locale The locale, formatted as a String with underscore (eg. en_US) the resulting
|
||||
* address should be localized in
|
||||
* @see android.location.Geocoder#getFromLocationName(String, int, double, double, double, double)
|
||||
*/
|
||||
protected List<Address> getFromLocationName(String locationName, int maxResults,
|
||||
protected abstract List<Address> getFromLocationName(String locationName, int maxResults,
|
||||
double lowerLeftLatitude, double lowerLeftLongitude, double upperRightLatitude,
|
||||
double upperRightLongitude, String locale) {
|
||||
return null;
|
||||
}
|
||||
double upperRightLongitude, String locale);
|
||||
|
||||
private class Backend extends GeocoderBackend.Stub {
|
||||
|
||||
|
|
Loading…
Reference in a new issue