How I show built in navigation options on google map iOS source and destination and navigation with voice or I have to implement google map api for this?
you can use the following code; it'll appear the selected location with drop annotation; and from google app you can navigate
https://developers.google.com/maps/documentation/ios-sdk/urlscheme
if ([[UIApplication sharedApplication] canOpenURL:[NSURL
URLWithString:#"comgooglemaps://"]])
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:#"comgooglemaps://?center=%f,%f&q=%f,%f",mosqueLocation.latitude,mosqueLocation.longitude, mosqueLocation.latitude,mosqueLocation.longitude]];
[[UIApplication sharedApplication] openURL:url];
} else {
NSLog(#"Can't use comgooglemaps://");
}
Related
I'm trying to open Google Maps app when I click on embed google maps sdk in Xcode. Please help me in order to find the solution?
Add one key in .plist file "LSApplicationQueriesSchemes" and mention one item "comgooglemaps" in that.
Then try this code.
if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:#"comgooglemaps:"]]) {
NSURL *directionsURL = [NSURL URLWithString:#"comgooglemaps://"];
[[UIApplication sharedApplication] openURL:directionsURL];
}
else{
[[UIApplication sharedApplication] openURL:[NSURL
URLWithString:#"https://itunes.apple.com/us/app/google-maps/id585027354?mt=8"]];
}
I want to open google map naviagation directly through googgle map App.
currenly i am using the code below
NSURL *testURL = [NSURL URLWithString:#"comgooglemaps-x-callback://"];
if ([[UIApplication sharedApplication] canOpenURL:testURL]) {
NSString *direction=[NSString stringWithFormat:#"comgooglemaps-x-callback://?saddr=%#,%#&daddr=%#,%#&x-success=sourceapp://?resume=true&x-source=AirApp", #"18.9750", #"72.8258", #"23.0300",#"72.5800"];
NSURL *directionsURL = [NSURL URLWithString:direction];
[[UIApplication sharedApplication] openURL:directionsURL];
}
else {
showAlert(AlertTitle, #"You don't have GoogleMaps App on this device. Please install it.");
//NSLog(#"Can't use comgooglemaps-x-callback:// on this device.");
}
}
But that is showing only direction and after that i need to click on navigation button in the App , is there is any way so that i can open google map navigation
directly.
Is it possible to force through your application that it will open the web link in safari only not in native app like facebook, twitter or web view etc.
So far i searched found only this code that is used for opening the link
NSURL *url = [NSURL URLWithString:#"www.facebook.com"];
[[UIApplication sharedApplication] openURL:url];
But what can we paste in else there below?
if ([[UIApplication sharedApplication] canOpenURL:nsurl]){
[[UIApplication sharedApplication] openURL:nsurl];
}
else {
//Open the url as usual, but how?
}
Use http://facebook.com/ instead of www.facebook.com
this will force a link to open in Safari instead of native app*
NSURL *myURL = [NSURL URLWithString:#"http://facebook.com/"];
if ([[UIApplication sharedApplication] canOpenURL:myURL]) {
[[UIApplication sharedApplication] openURL:myURL];
}
You can use a webView to open any link of your choice.
I'm working on iOS application. Here is the code i used
NSURL *url = [NSURL URLWithString:#"fb://page/5718758966"];
if ([[UIApplication sharedApplication] canOpenURL:url])
{
[[UIApplication sharedApplication] openURL:url];
}
else
{
//Open the url as usual
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://facebook.com/5718758966"]];
}
As I mentioned, this code has worked to open Facebook app but shows blank page; my question is if there is an alternative link I can use that will both open the app and direct the user to this specific page, or is this simply a Facebook bug?
Thanks!
Instead of "fb://page/5718758966" try "fb://profile/5718758966" for your URL.
I was trying to open the Facebook app with particular Facebook page from my app with the following code:
NSURL *url = [NSURL URLWithString:#"http://www.facebook.com/pagename"];
[[UIApplication sharedApplication] openURL:url];
When I click on the button it opens the Facebook app but the required page doesn't load or show.
Is there any other way to open the Facebook app with particular Facebook page? Please correct me If I am doing something wrong.
Thanks in advance.
To open the facebook app directly you should do the following:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString: #"fb://profile/PAGE_ID"]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"fb://profile/PAGE_ID"]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://facebook.com/PAGE_NAME"]];
}
This is a solution including a fallback for web.
To determine your PAGE_ID you could use a service like this.