I have a requirement where I need to navigate to another Activity or page created in my core project of my PCL app. All the sample I checked takes me to a website using the URI. What should i change in the code below that will allow me to navigate to different pages in my app when the pin is clicked?
public class CustomMapRenderer : MapRenderer, GoogleMap.IInfoWindowAdapter
{
...
void OnInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e)
{
var url = Android.Net.Uri.Parse(customPin.Url);
var intent = new Intent(Intent.ActionView, url);
intent.AddFlags(ActivityFlags.NewTask);
Android.App.Application.Context.StartActivity(intent);
}
}
You generally call back to your custom map in the PCL and let it handle the navigation.
The way I do it is by:
1) Add a bindable property of type ICommand to the custom map
2) Add a public method to the custom map that will be called by the custom renderer
3) In the custom renderer in your OnInfoWindowClick call the public method
This allows you to bind a command to the custom map and handle the Url in your view model.