2023-07-14 20:02:34 +02:00
|
|
|
package android.location;
|
|
|
|
|
|
2024-04-12 18:32:30 +02:00
|
|
|
import android.os.Bundle;
|
|
|
|
|
|
2024-11-22 18:02:54 +01:00
|
|
|
import java.util.Collections;
|
2023-07-14 20:02:34 +02:00
|
|
|
import java.util.HashSet;
|
2024-11-22 18:02:54 +01:00
|
|
|
import java.util.List;
|
2023-07-14 20:02:34 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
public class LocationManager {
|
|
|
|
|
|
|
|
|
|
static Set<LocationListener> listeners = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
public String getBestProvider(Criteria criteria, boolean enabledOnly) {
|
|
|
|
|
return "xdgportal";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Location getLastKnownLocation(String provider) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void requestLocationUpdates (String provider, long minTimeMs, float minDistanceM, LocationListener listener) {
|
|
|
|
|
listeners.add(listener);
|
|
|
|
|
nativeGetLocation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private native void nativeGetLocation();
|
|
|
|
|
|
|
|
|
|
private static void locationUpdated(double latitude, double longitude, double heading) {
|
|
|
|
|
for (LocationListener locationListener : listeners) {
|
|
|
|
|
locationListener.onLocationChanged(new Location(latitude, longitude, heading));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-12 18:32:30 +02:00
|
|
|
|
|
|
|
|
public boolean sendExtraCommand(String provider, String command, Bundle extras) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void removeUpdates(LocationListener listener) {
|
|
|
|
|
}
|
2024-11-22 18:02:54 +01:00
|
|
|
|
|
|
|
|
public List<String> getAllProviders() {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
2023-07-14 20:02:34 +02:00
|
|
|
}
|