2
我想实施我自己的位置服务。它将基于附近接入点的wifi信号强度的三角测量。如何编写自己的Android LocationService?
我知道算法来确定我的位置,但我不知道如何将它集成到我的代码中,以便我可以简单地将LocationListener添加到我的服务中。
MyWifiLocationService wifiLocationService = new MyWifiLocationService();
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
//has to be called, if there is a new location (via wifi triangulation)
}
public void onProviderDisabled(String provider) {}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle extras) {}
};
wifiLocationService.setLocationListener(locationListener);
我该如何编写MyWifiLocationService类?有人知道这样的教程吗?