Searching locations with name in google maps sdk in ios - ios

I am using Google map sdk in my project. I have search bar at top and I have to search the location that user enter in that search bar. Secondly search bar should give hints like if we search location in Google maps application.Any help will be appreciate able.

Prerequisites
Google Places API KEY
Get Started with GOOGLE PLACE API on iOS
STEPS
You need to create an url using the text entered in your textfield.
Append the text from textfield the create an url like this
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:#"https://maps.googleapis.com/maps/api/place/textsearch/json?query=%#&key=%s",queryText,kGooglePlaceAPIKey]];
where queryText is the text, and kGooglePlaceAPIKey is your GOOGLE PLACES API KEY.
Do JSON Parsing on this URL.
You will get the information of all location related to the text entered in your textfield.
Figure : JSON Response on Firefox Browser using JSONViewer Addon
FOR MORE INFORMATION REFER THIS SITE : Google Places Text Search Requests
Hope it helps You
Cheers
:)

Related

Hide the url shown in WebViews in iOS when signing in using ADB2C and react-native-msal

Problem:
I want to hide the url that is shown in the WebViews when logging in using ADB2C in iOS.
Platform: React Native
library: react-native-msal
The Url Shown in red
Things I tried: I tried changing the parameters
ios_webviewType?: Ios_MSALWebviewType;
and
ios_presentationStyle?: Ios_ModalPresentationStyle;
But did not find a way to hide the URL.
(Even though wkwebiew hid the url, Google does not support it)
Expected Result: The WebViews should open for selection of account without any url in the top.
Please let me know if any more information is needed. Thank you.
It’s not possible with the type of web view google requires in iOS.

Swift - OpenUrl for Google map doesn't show the direction (loading forever)

I'm working on an iOS app where I need to open Google Maps to navigate to a location. I'm using the Scheme for iOS comgooglemaps:\\
Here is my code :
guard let url = URL(string: "comgooglemaps://?saddr=&daddr=\(latitude),\(longitude)&directionsmode=\(travelMode)"), UIApplication.shared.canOpenURL(url) else {
return
}
UIApplication.shared.open(url)
But the problem is, once on Google Maps, the route is not showing on the map and Google Maps is loading forever if Google Maps wasn't already started. I'm using iOS 14.4.1.
This happen using the current user location and I need it
Edit for Universal Link: That's an idea too and I forgot to precise that I test it but there is a bug too. When the user doesn't accept location on Google Maps, instead of asking to complete the form for the origin point and set the destination, Google Maps return a totally blank form. On Android, the destination is set.
As per documentation, you can also use https:// links, as Maps support universal links. This seems to work fine, even while the comgooglemaps:// url fails to load directions. Check docs for information on individual parameters. Here's an example matching your query:
https://www.google.com/maps/dir/?api=1&destination=\(latitude),\(longitude)&travelmode=\(travelMode)

Here Maps how to create address suggestions iOS SDK Premium?

I'm developing an iOS app using Here Maps. Current SDK version is 3.1, but I also checked with 3.3.
The app has a text field for searching the address. It is essential to suggest the address for the user of the closest partial search string, like autosuggestion.
Currently, I'm using geocoder request:
NMAGeocodeRequest *request = [[NMAGeocoder sharedGeocoder]
createGeocodeRequestWithQuery:searchText searchRadius:10000
searchCenter:[currentPosition coordinates]];
with current position of the iPhone (checked) and radius 10km.
But in result I'm receiving results from all over the world.
Is there a better way to do it with Here Maps?
You can use NMAAutoSuggestionRequest, it handles this use case.
[1] Text AutoSuggestion Requests User Guide

Back button on google maps ios

My Iphone app needs to open the google maps application to use the StreetView and the directions mode.
All works fine,But my question is, is there any way of adding a button or something to go back to my app?. I have seen that with UIWebViews maybe thats the only solution..
Thanks in advance
My answer comes from this documentation: Google Maps SDK for iOS, Google Maps URL Scheme
You may add a back button if you register a custom URL scheme for your app and use the comgooglemaps-x-callback:// url scheme to launch the Google Maps iOS app.
Here is a great tutorial for iOS Custom URL Schemes.
The following string would open Google Maps with directions to JFK airport and would add a button in Google Maps with the title "AirApp".
Touching that button would call the custom url scheme sourceapp:// which you would set up by following the tutorial I linked to above.
#"comgooglemaps-x-callback://?daddr=John+F.+Kennedy+International+Airport,+Van+Wyck+Expressway,+Jamaica,+New+York&x-success=sourceapp://?resume=true&x-source=AirApp"

Does MKMapView support the "little man" street view?

There is no little man icon to drag onto a street in a map.
Is there a way to enable him programmatically?
Thanks.
The MKMapView does not have support for the "little man" (Pegman) or Street View.
One alternative is to use the Google Maps Javascript API V3 directly. In a UIWebView, load an html file (added as a resource in your app) containing a Google map. For sample html files containing Street View, look for the streetview-*.html files on the Google Maps Javascript API V3 Examples page.
Another alternative is to call the Maps app from yours using openURL: and pass it a Map Link. This will only work on the device (the simulator doesn't have the Maps app and will open the browser instead).

Resources