Enabling "navigation" mode in skobbler Android API - android

I can't find a way to make my app, which currently implements SKmaps to the point of showing a route, show the route and follow the route like a car navigator.
example:
This is my "route loading" method:
#Override
public void onAllRoutesCompleted() {
SKNavigationSettings navigationSettings = new SKNavigationSettings();
navigationSettings.setNavigationType(SKNavigationSettings.SKNavigationType.REAL);
navigationSettings.setNavigationMode(SKNavigationSettings.SKNavigationMode.CAR);
navigationSettings.setCcpAsCurrentPosition(true);
navigationSettings.setFcdEnabled(true);
SKNavigationManager navigationManager = SKNavigationManager.getInstance();
navigationManager.setMapView(mapView);
navigationManager.setNavigationListener(MainActivity.this);
navigationManager.startNavigation(navigationSettings);
}

found it on the demo app code.
mapView.getMapSettings().setMapDisplayMode(SKMapSettings.SKMapDisplayMode.MODE_3D);

Related

Mapbox reverse geocoding does not always return a result

Im trying reverse geocoding example on mapbox
Everything's working fine. But the problem is when i replace my current location it doesnt return a result.
I think that mapbox doesnt have much data about my region (Im in Vietnam). Is there anyway to add my own places supposed that I had a dataset of coordinate and address
My code:
mapboxGeocoding = MapboxGeocoding.builder()
.accessToken(getString(R.string.mapbox_access_token))
.query(Point.fromLngLat(106.799142,10.875838))
.geocodingTypes(GeocodingCriteria.TYPE_ADDRESS)
.build();;
mapboxGeocoding.enqueueCall(new Callback<GeocodingResponse>() {
#Override
public void onResponse(Call<GeocodingResponse> call, Response<GeocodingResponse> response) {
List<CarmenFeature> results = response.body().features();
if (results.size() > 0) {
// Log the first results Point.
//Point firstResultPoint = results.get(0).center();
String country=results.get(0).placeName();
Log.d("Geocoding",country);
} else {
// No result for your request were found.
Toast.makeText(getApplicationContext(), "onResponse: No result found", Toast.LENGTH_LONG).show();
}
}
#Override
public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
throwable.printStackTrace();
}
});
}
#Override
protected void onDestroy(){
super.onDestroy();
mapboxGeocoding.cancelCall();
}
There is currently no way of adding custom POIs to the data powering the Geocoding API, but the workaround is to use the Tilequery API. This API retrieves features from vector tiles based on proximity to a particular geographic coordinate. You can mimic reverse geocoding functionality with custom POIs via the following workflow:
Create a tileset which contains your Custom POIs. That is, upload your data as a tileset.
Retrieve the geographic coordinates of the point that you would like to use for reverse geocoding.
Make a call to the Tilequery API where radius is 0, tileset_id is the id of the tileset you created in step 1, and {lon},{lat} are the longitude and latitude retrieved in step 2. More details about each of these parameters can be found here.
I'd recommend working through this tutorial on making a healthy food finder with the Tilequery API, to gain more intuition about how the API can be used for reverse geocoding with custom POIs. The Tilequery API playground is also an excellent resource for interactive experimentation.
Let me know if something is unclear!

Reroute bannerinstruction while offroutelistener detected

I am overriding allowreroutefrom() function from routelistener to pick up my custom route when offroutelistener is detected. I am returning false and starting the new navigation with custom computed route. But I want to show the Rerouting bannerinstruction when reroute happens. How to give our own instruction in banner?
The InstructionView has showRerouteState() and hideRerouteState() methods that you can use:
#Override
public boolean allowRerouteFrom(Point offRoutePoint) {
// Fetch new route
InstructionView instructionView = findViewById(R.id.instructionView);
instructionView.showRerouteState();
return false;
}

Google map geoJson layer feature info on click

smart people :)!
Story: I have many layers what I have added to google maps in android. I am adding them by iterating - creating new GeoJsonLayer and calling method addLayerToMap(). I have created setOnFeatureClickListener on last GeoJsonLayer (Maybe here is the problem).
Problem: When I click on feature (LineString, Polygon) I receive information only about last Layer - polygon. Then I added mMap.setOnPolylineClickListener(), then click listener is going into correct methods - for LineString in PolyLineClick... etc, but here again is problem - how can I get information from Polyline about LineString properties, what I added to geoJson?
Question: What is the best approach to add layers to map , so I can manage click events and show LineString or Polygon properties for user?
Code example:
geoJsonLayer.setOnFeatureClickListener(new GeoJsonLayer.GeoJsonOnFeatureClickListener() {
#Override
public void onFeatureClick(Feature feature) {
mMap.setOnPolylineClickListener(new GoogleMap.OnPolylineClickListener() {
#Override
public void onPolylineClick(Polyline polyline) {
//TODO show LineString properties
//Comes here when LineString clicked
}
});
mMap.setOnPolygonClickListener(new GoogleMap.OnPolygonClickListener() {
#Override
public void onPolygonClick(Polygon polygon) {
//TODO show Polygon properties
//Comes here when Polygon clicked
}
});
}
Found solution - added all layers into 1 layer and everything works fine.

Info Window on shapes(circle, polygon) in Android Maps App

I have an android app which one of its screens uses google maps, and I load some regions on it. I want to be able to click on a region/shape(circle or polygon) and an info window to appear. I am searching but I cant find enough information on how to show info windows on shapes, only on markers. Is that not a common practice? What should I do? Could anyone help, even theoretically? Any help or direction would be appreciated, thank you very much!
Create a customCircleOnClickListener (or don't and use the title and
snippet properties, as I am doing in step 3).
Then add:
mMap.setInfoWindowAdapter(new
CustomInfoWindowAdapter(MainActivity.this));
mMap.setOnCircleClickListener(customCircleOnClickListener());
Finally:
public GoogleMap.OnCircleClickListener customCircleOnClickListener() {
return new GoogleMap.OnCircleClickListener() {
#Override
public void onCircleClick(Circle circle) {
Log.d("MainActivity", "Clicked a ball!");
POIAnnotationCircle annotCircle = annotationsByCircle.get(circle);
markerForInfoWindow = mMap.addMarker(new MarkerOptions()
.alpha(0.0f)
.infoWindowAnchor(.6f,1.0f)
.position(annotCircle.getCoordinate())
.title(annotCircle.getTitle())
.snippet(annotCircle.getSnippet()));
markerForInfoWindow.showInfoWindow();
}
};
}

Disable Panning and Zooming on Teechart Monodroid

I have created a class that inherits from Steema.TeeChart.TChart I am trying to disable panning and zooming, I have the below code but it still allows the user to pan and zoom on the device.
public class BaseChart : TChart
{
public BaseChart(Context context, string headerTitle)
: base(context)
{
_headerTitle = headerTitle;
SetDefaults();
}
private void SetDefaults()
{
Chart.Zoom.Allow = false;
Chart.Panning.Allow = ScrollModes.None;
Zoom.Allow = false;
Panning.Allow = ScrollModes.None;
}
}
TeeChart .NET standard zoom & scrolling is not working at the present moment in the Mono for Android version. We plan supporting it in future releases feature request being TM63016321 in our issue tracking system. Recently we implemented a new feature for MfA which disables both zooming and scrolling:
tChart1.Zoom.Style = Steema.TeeChart.ZoomStyles.None;
UPDATE: A new Zoom.Style option has been implemented: ZoomStyles.Classic. Now you can choose if you want to toggle zooming, panning and which directions are supported for both. A maintenance release has been published supporting that. The new version explains how to use ZoomStyles.Classic in the zooming/panning tutorial included, for example:
tChart1.Zoom.Allow = true;
tChart1.Zoom.Direction = Steema.TeeChart.ZoomDirections.Both;
tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.Horizontal;

Categories

Resources