how to load iPhone application from web application - iphone

I have web application for mobile (developed in .net), I want to use iPhone maps application from web application( i.e. from web browser on button click)..how to do it? I want to do same in android to.

I don't know about Android, but this page describes how to construct a URL that will open the iPhone's Maps application.

If you are trying to view a map from a web application (viewed in the mobile browser), simply link to Google maps as you normally would. Some mobile OS's will open their native maps application, and the others will receive Google's mobile-optimized maps website.
Edit:
As Robot K said, the http://maps.google.com URIs will be intercepted on iOS and open the native map application. If you want to force the same behavior on Android, you will have to do user agent detection and use the geo uri scheme documented here.
The user agent detection is to determine whether the link you attempt to load is the http scheme for iOS or the geo scheme for android.

Related

How to launch Google Maps on iPhone via web link?

I am building a site that will have address links as well as image of a map - both of which have a link to Google Maps.
The problem is that when I click on these links using my iPhone - or any address link that shows up in an email, the result is that either the native Apple Maps app opens or the Google Maps in the browser. I want for the native Google Maps app to open every time, and ideally for every user (whose iPhone I have no control of).
If I use the Chrome app for iPhone, then there's a little trick to do this:
http://www.redmondpie.com/how-to-set-google-maps-for-iphone-default-app-for-opening-map-links/
But the reality is that the trick above will not open the Google Maps app. It will open the web version of Google Maps inside the Chrome app. Then an icon shows up at the bottom asking if you want to open the native app instead. This is better than nothing, but far from ideal. I appreciate any help. Thank you. BTW, I'd like to do this without jailbreaking the iPhone - I'm looking for a solution that will work with other people's iPhones.
You can use apple's interface which is a bit more intelligent when using different browsers and devices:
http://maps.apple.com/?q=51.507269,-0.127695
Clicking the above url on the following devices:
iPhone|iPad:
Opens Apple maps app
Android:
Gives you a choice to open in either Google Maps App or Google maps website
Windows Phone:
Opens Google maps mobile website
Windows 8 Desktop:
Opens Google maps website
Apple OS Desktop:
Opens the new maps app (Mavericks)!!
For more info see:
Apple URL Scheme Reference
To open Google native app you need to write:
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"comgooglemaps://"]];
Example :
comgooglemaps://?q=Pizza&center=37.759748,-122.427135
I just tested this and it worked in pulling up Google Maps instead of the default Apple Maps application.
Testing Maps
However, after deleting the Google Maps app for iOS, the link fails to open anything because that schema is no longer available and doesn't fallback to a generic maps link... almost seems like you would need to provide two links for Google Maps for iPhone and another generic Apple Map link...
Take a look at this.
It works on every device (for ios / android, it will launch google maps app else browser).
For other devices, it will launch browser.
Simple use case would be:
Construct universal map URI (with encoded params)
Use this URL like -
window.open(mapUrl, '_system');
More info for window.open here
My use case required to open existing in app map navigation into some another dedicated maps app (preferably google maps app) for ios and android devices.
I use ionic v1 + cordova for building native apps. Not sure if this is perfect for your use case but hope this helps.

Launching the iPhone native Maps app with current location

I've seen a lot of code samples here on how to launch the Maps app but none of them actually launch the native app, they all launch Google's website on Safari instead (http://maps.google.com...). I've seen an app before, can't recall the name, that launched the iPhone maps application itself and on the address bar of the apps it has a string that looked like "hotel loc:XX.XXXX, XX.XXXX" which would select the current location on the map based on the coordinates provided on the address and pin point all hotels in the nearby area (visible area). I'm positive that it launched the native app because all the app settings were there and of course the app was among the running apps on the phone and safari wasn't open. I looked at the MapKit but wasn't able to pass that address to it from code ("hotel loc:longitude, latitude").
Does any of you guys happen to know how to launch the actual native app and pass an address to it?
https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
URLs launched from within an app that fulfil the criteria in the developer document will open up in the Maps application. This is a key difference, because in most applications you use a custom URL scheme, whereas for the maps you simply fire up a URL for maps.google.com
However, if you a) don't follow the specs in that document to the letter, or b) are running in the simulator, you'll go to the Google Maps web page in Safari.

How to gain direct access to the hardware capabilities of mobile devices from mobile browsers

We are developing web browser application for mobile phones and I am trying to figure out a way that I can gain access to the camera and take a photo and then upload it to the internet. But so far what I was suggested is to use phonegap and create native application. Phonegap is fine but it is not what I am looking for because my client wants to design forms and these html forms somehow will be able to trigger the camera and take photo and upload it to a server. Do you think developing a native API for every platform and having access to its functions from the web browsers is possible? What your suggestion would be?
(Note: My customer only want application that can run on mobile web browsers no native application runs on I-Phone, windows mobile, Blackberry and Android)
Thanks a lot...
Web apps (not wrapped in native code as Kumar details) cannot access all device hardware and sensors. Location support is available on iOS and Android, but camera access is only available on Android (via JavaScript). Similarly, device motion APIs are not accessible on Android, but are on iOS.
As you can see, support is sketchy and if you are truly looking to use such features, you are better off (and in many cases, realistically looking at) writing native apps for each platform you intend to support.
HTML5 is not yet at the point where it can replace native apps. It can do some of the things that native apps can, but even then performance is suboptimal. Currently, native apps may be more difficult and time-consuming, but they are necessary.
Calling android native APIs from javascript functions of embedded WebView
Use JS to call Java code which will in-turn call the Camera API or whatever else you are looking for.
It's not going to be possible to do it on iPhone, the only known way of accessing the camera is through the Cocoa layer.

iPhone Mobile Safari File System Access

Is it possible to write to a file in a native iPhone application and have a Safari browser read from that file after having the browser opened from the native app?
Alternatively (and this would be great!), would it be possible to launch a mobile Safari webapp from a native iPhone app, and have that application access the OS 3.0 External Accessory Framework? My assumption is no...
Basically, I have a functioning iPhone app that wraps a simple mobile Safari webapp, but I'd like to utilize the external accessory framework once I have launched the Safari webapp from the iPhone app...
You can use the phonegap framework : it provide a project template and libraries to access native function in javascript (like writing/reading a file).
Consider also the localstorage and the SQLLite DB...
There are 2 different interpretations. If you want to launch MobileSafari from your app, then the answers will be no since MobileSafari and your app are isolated by sandboxes. But you may include the detail in the URL like
http://example.com?info=SXMgaXQgcG9zc2libGUgdG8gd3JpdGUgdG8gYSBma…
But you can embed a UIWebView in your app, then the answers will be yes (to the UIWebView), since you may communicate with the web view with any ObjC code.

Launching a native application from a link of website on iPhone

I have a query regarding launching a native application from a link of website on iPhone.
I will explain.
Generally a web based application is used to work online without using any feature of iPhone device (such as GPS, Camera, Accelerometer etc.)
I have a iPhone specific website which performs many tasks online.
Now while keeping all the functionality same, I want to add a feature of taking a picture from iPhone in-built camera.
i.e. when user clicks a button on website "Take Picture", my native application should be launched, which will take a picture and do specific tasks..
How to capture a event of button click which is performed on website?
Should I use UIWebView or Safari?
I know that using URL Scheme we can launch Safari from native application.
But how to achieve the opposite as explained above?
All other functionality works great on website, so I don't want to convert the whole website into native application.
(Otherwise I will have to deal with web services). Only this functionality needs to be added.
Register a URL Handler, then have a link on your site to myapphandle://some.parameters.here/
A la: http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html