Form l_form = new Form("Google Maps");
l_form.setLayout(new BorderLayout());
final MapContainer l_map = new MapContainer();
final Label l_label = new Label("Location: ...");
try {
l_map.addMarker(EncodedImage.create("maps-pin.png"), new Coord(41.889, -87.622), "Hi marker", "Hello", new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Dialog.show("Marker Clicked!", "You clicked the marker", "OK", null);
}
});
} catch (IOException e) {
e.printStackTrace();
}
l_map.addMapListener(new MapListener() {
public void mapPositionUpdated(Component source, int zoom, Coord center) {
l_label.setText("0 lon: " + l_map.getCoordAtPosition(0, 0).getLongitude()+ " w lon " + l_map.getCoordAtPosition(Display.getInstance().getDisplayWidth(), 0).getLongitude());
}
});
l_form.addComponent(BorderLayout.SOUTH, l_label);
l_form.addComponent(BorderLayout.CENTER, l_map);
addSidebar(l_form);
g_current = l_form;
l_form.show();I used Android Studio for debugging. The problem was, that the api - key was an old one.
02-05 17:30:23.467 22331-22405/? E/b: Authentication failed on the server.
02-05
17:30:23.467 22331-22405/? E/Google Maps Android API: Authorization
failure. Please see
https://developers.google.com/maps/documentation/android-api/start for
how to correctly set up the map.
02-05 17:30:23.477 22331-22405/?
E/Google Maps Android API: In the Google Developer Console
(https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: --------------------------------------------------
Android Application
(<cert_fingerprint>;<package_name>):