2
Ich habe eine Google Map. Im Simulator funktioniert alles gut, aber in Android-Gerät findet nie den aktuellen Speicherort (zeigt die Nachricht Location Error - siehe Code). Die Karte öffnet sich in der Weltansicht ...Codenameone google map
cnt = new MapContainer(new GoogleMapsProvider(""));
cnt.setMapType(MAP_TYPE_TERRAIN);
LocationManager locationManager = LocationManager.getLocationManager();
InfiniteProgress ip = new InfiniteProgress();
Dialog ipDlg = ip.showInifiniteBlocking();
Location loc = LocationManager.getLocationManager().getCurrentLocationSync(30000);
ipDlg.dispose();
if (loc == null) {
try {
loc = LocationManager.getLocationManager().getCurrentLocation();
} catch (IOException err) {
Dialog.show("Location Error", "Unable to find your current location, please be sure that your GPS is turned on", "OK", null);
return;
}
}
locationManager.setLocationListener(this);
if (loc != null) {
double lat = loc.getLatitude();
double lng = loc.getLongitude();
Coord coordinate = new Coord(lat, lng);
}
Das GPS ist auf dem Gerät aktiv. Ich kann meinen Standort in anderen Apps sehen.
Dank. Der Standardspeicherort hat funktioniert. Es dauert sehr lange, das Formular mit der Karte zu öffnen ... 20/30 sec ... ist das normal? wenn ich zurück gehe Form und wieder eingeben dauert noch mehr Zeit ... es zeigt den unendlichen Fortschritt, so denke ich, es dauert sehr lange, um den Ort zu finden ... – atmenezes
Ich vergaß zu erwähnen, dass dieser Prozess in 'erfolgen sollte postShow() 'und nicht in' beforeShow() ' – Diamond
Vermeiden Sie auch InfiniteBlocking, es ärgert Benutzer. Normalerweise füge ich InfiniteProgress oben rechts oder anderswo zur Symbolleiste hinzu und entferne es, sobald der Vorgang abgeschlossen ist. – Diamond