I've got an issue with an app builded on phonegap build (build.phonegap.com) on iOS with Phonegap 2.3.
I'm trying to open the native map application with this link :
<a id="gmap_image" href="">
</a>
The js code that sets the href attribute :
$("#gmap_image").href('http://maps.apple.com/?q='+$xml.find( "adresse" ).text());
I've seen that for opening native maps application with a link, i have to give an url based on maps.apple.com domain (Apple Map Links).
But when I click on the link, all that happens is that the page refreshes (and I don't know why it refreshes too because no code asks to do it).
Has someone an idea ?
Regards,
maybe it's too late, but i had the same issue.
Try this way:
$("#gmap_image").href('maps:q='+$xml.find( "adresse" ).text());
just change http://maps.apple.com/?q= into maps:q=
that works for me
You can launch the google Maps app on an iOS device using this header in the URL Scheme. comgooglemaps:// This is according to the developer documentation found here. https://developers.google.com/maps/documentation/ios/urlscheme
for example a web link to open the Google Maps app in iOS6 and get directions from New York to Washington DC would look like this.
Directions from New York, NY to Washington DC
Try this one
$('#map').bind('tap', function(){
var url = 'http://maps.google.com/maps?';
url += 'q=[place_name]'; //add ur querystrings
// open the native maps app by calling window location
window.location = url;
});
Unfortunately, this is a no-go on iOS 6, since Google maps is no longer "natively" part of the OS.
Though you can still launch Apple Maps, since this is supported natively.
If you are using one of the latest PhoneGap/Cordova versions, it seems that it's not longer possible to open safari or maps from standard "a href=xxx" tags.
In order to open maps, you will need to attach a click event and open the link using:
window.open('http://maps.apple.com/?q=whavever', '_system');
within Phonegap, window.open() will open a link with a new in app browser, but, if you specify '_system' as the second param, it will send the URL to the OS (thus, opening the maps app in this situation).
Related
My app has an several shareable route map links that are formatted as follows and no longer work - meaning they won't natively open in the browser. Instead, both iPhone and Android see the link and are trying to open in Google Maps APP - which breaks the links:
var link = https://www.google.com/maps/d/viewer?mid=14DdJfOLp26RFilzX0tp2hs_M7gBBNFkk&ll=27.931760141489143%2C-82.47564270000004&z=16
window.open(link,'_system','location=yes') ;
I found similar issues from users talking about the problem, but the fix (if it works) requires the user to tweak some settings on their phone. (issue: https://support.google.com/maps/thread/8806737?hl=en ) which for app developers is not a solution.
Previously when opening the links it would natively open in the phones/system default browser (ie: chrome/safari) and everything worked fine. Recently this behavior has changed. Both iPhone and Android phones now seem to recognize the url google.com/maps causing the system to ask the user to open this link in their Maps app....or in the system browser. On iPhone, it doesn't even ask, it just defaults to using the map app. If the user chooses to open in the map app (or on iPhone it simply defaults to it), the above shareable route map won't load - saying map can't be found (or some other error).
On Android, since it at least asks the user: Maps or Chrome - if the user chooses Chrome then the link will work.
This new default behavior is causing shareable route maps to break on iPhone...and on Android where users choose Maps over Chrome.
On Android, I found a way to force these types of maps to use Chrome by using a url scheme. Forcing the map to chrome would look like:
window.open("googlechrome://" +link,'_system','location=yes') ;
However, a url scheme does not exist for Safari on iPhone...causing even this kind of work around to still break on iPad and iPhones.
Either google needs to allow shareable maps back on the default Map app....and/or iPhone needs to create a specific url scheme for Safari....preferably both.
OR....does anyone else have a fix/work around for this on iPhone - or in general?
I found a lot of tutorials about opening an app by a custom url scheme like:
myappname://
Thats nice but it would be great to open an app by registering the real app domain over the http link like
http://www.myappdomain.com/blablabla
So - for example - if a visitor comes to a webpage (on her/his mobile) it is normally opened in the browser, excepts the installed app is listening to the opened URL and opens itself instead of the browser.
How is this done (i've seen this at another app). Any help would be great. Thanks in advance!
It is a new feature in iOS9. It is explained in the WWDC15 talk Seamless linking to your App.
You could also add a small piece of javascript to each page that opens your custom URL-scheme.
My company created an app that sends location deals in an app inbox. I want to send directions in the appmail so that if someone clicks on 'Click here for directions' it will automatically open directions from current location to the requested point in the Apple Maps app.
When I email the URL to myself and open it with AppMail, it works perfect.
When I send the URL via AppMail, it opens the URL in safari via GoogleMaps.
This is the URL I'm using.
>>Click Here for Directions<<
You need to change:
http://maps.apple.com/?...
To one of:
http://maps.apple.com/maps?...
or
http://maps.google.com/maps?...
The apple.com URL is technically the correct one, but the google URL is the only one that will work properly on older versions of iOS, and new versions of iOS also support it as well (although I don't know how long that will last).
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"
This might be a easy question but i couldn't find solution. I want to open AppWorld by clicking a button in my BB application. For example when user clicks this button Appworld will show "Facebook Application" page. Can i do this?
In Android platform this line launches GooglePlay for Facebook App. Does BlackBerry supports this kind of method?
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.facebook.katana")));
Here is a simple way to do this:
Browser.getDefaultSession().displayPage("http://appworld.blackberry.com/webstore/content/2360/?lang=en");
Above code will invoke the browser in the application and open the BlackBerry App World, I tested it in device and it's perfectly working. For now I put a Whats App messenger link, but you can customize the link according to your requirement.
You can open App World from your BB application directly using the following code. This code avoids opening the browser first.
Registry registry = Registry.getRegistry(this.getClass().getName());
Invocation invocation = new Invocation(null, null,
"net.rim.bb.appworld.Content",
false, ContentHandler.ACTION_OPEN);
invocation.setArgs(new String[] { /* app id in appworld */ });
registry.invoke(invocation);