Launching app from custom urlscheme - iphone

I am developing an iPhone app that can be launching via a link to a custom URL scheme from an email.
When the app is launched from the email, I want to populate a text box with an order number that is appended to the launching URL (appname:\\?orderno=1234). I can launch the app from the URL fine.
My problem is extracting the orderno variable from the URL and adding the value to the textbox. I have achieved it with preferences but it only shows the value, the second time the app is launched. How can I extract the variable in the Appdelegate and then allow it for use in the view controller.
Please help!

Have you tried implementing -handleOpenUrl: in your applicationDelegate?
See also this question:
How to use UIApplication handleOpenURL Notifications

Related

iOS web app "Open this page in Maps?" popup when trying to open the Maps App

I'm writing an iPhone web app using HTML5/CSS3. I need to embed a link to open a built-in maps app from my web app. To open a location on the map I redirect mobile Safari to URL like this:
http://maps.google.com?q=Business+Name%26+Street+Address+City+State+Zip
In this case if a user taps on this link the iPhone opens up the maps app and displays the location specified in the URL.
But when I need to provide a URL for driving directions to a predefined location:
http://maps.google.com/maps?saddr=1234+1st+ave+portland+or&daddr=Business+Name%26+Street+Address+City+State+Zip
I've encountered a strange situation when in some cases the iPhone displays a pupup message:
Open this page in "Maps"?
with a choice of yes and no, and only if a user taps Yes, the maps opens up with directions. Note that this popup shows only for some addresses.
Is there any way to prevent this popup from showing at all?
I've created simple web page. Put a link and set google map link with query string value of particular address on src attribute of link element,run it to my iPhone 4.It is working fine, I'm not getting any window to ask it open on map app.
I noticed that you've used "saddr" as a query string parameter. You can replace that with "q" query string parameter.

How can you create a link wrapped into an app Icon?

I've seen a lot of apps that can create icons for on the home screen. You add it through the normal Add on Home Screeen and when you click on the app it will directly start calling or whatever. This must be done by immediately redirecting to an url like sms:// or tel:// depending on what you are trying to do. But how is this accomplished?
How can you let a page be bookmarked normally so it will get the icon and then when it's pressed immediately redirect it to a specific url?
I THINK, these icons are made using Configuration Profiles & application links (url schemes).
Have a look at this thread: Installing a configuration profile on iPhone - programmatically
But they didn't find a solution in there. Profiles can only be installed via MobileSafari, they say. Not via a UIWebView. So i'm not sure how it's possible from native apps.
Anyhow the preference shortcuts aren't working anymore on iOS 5.1.
As soon as your app is opened, you call:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"http://www.google.com"]];

Invoking another application using URL Scheme in iphone

i want to load another iphone application when i click the button on the current application. The application which has to be loaded is DataStore (appl name). I added URL scheme to this application in plist file. URL scheme is dbapp, URL identifier is com.dbapp.
In the current application(Testdb) i have the code is
-(IBAction) btnClicked {
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:#"dbapp://"]];
}
But it is not invoking the DataStore application when i click the button. please help me out.
Thanks.
You can try to embed a link into a hmtl document and have the embedded Safari load that html - e.g. via an external server or maybe.
When you click on the link you should see the registered application load. If it doesn't then you have to look for the error in registration of the url-handler.

Custom URL scheme embedded in an SMS on iPhone

Has anyone been able to successfully embed a custom url scheme in an SMS (for example someApp://), such that the iPhone upon receiving the SMS creates a clickable link to launch an app?
There are various questions similar to this out here, however, I have not seen a working solution.
Thanks
In general a custom URL scheme is the way to solve this problem. However, this is complicated by the fact that in iOS 5 (and up through iOS 5.1.1 based on my recent testing), Apple introduced a bug into their Messages app so that custom URLs received via SMS are not recognized as links.
See Custom URL scheme not recognized as link in SMS app(only in iphone 4 iOS 5.0)
You have to create URL scheme which starts with http, https or www.
but http:// and https:// will not work in URL scheme, so If you want create a click able link, you have to set your URL scheme with www.
For eg. www.myapp then the link which can open your app will be www.myapp:// but in this case only www.myapp will be click able and :// will not be click able.
For this use this format for URL scheme
www.<characters1>.<characters2>
www.my.app //example
Now use this format to open your app with click able URL:-
www.<characters1>.<characters2>://<anyThingYouWantToAppend>
www.my.app://open //example
www..:// is enough to open your app, but we are appending anyThingYouWantToAppend to create click able URL.
In my case on iOS 6, the link is not blue if sent from a custom sender ie text instead of a number. As soon as we started using a shortnumber as sender instead of a custom name, it was recognized as a link.
Assuming you have defined a custom url scheme as someApp:// you create a link in an SMS as follows:
"someApp://Myurl"

Access TomTom navigation solution via URL scheme

I'm currently working on an iPhone Application which allows the user to navigate to POIs. Those POIs are defined via lat/lon, and the user should have the possibility to start his navigation solution with one click to navigate to this POI.
This works fine with Navigon, using URL scheme navigon://myapp|name||||||lat|lon
Now I know that there is an URL scheme named tomtomplus:// for the TomTom iPhone app, I'm only able to start tomtom, no other action is possile.
I tried tomtomhome://geo:action=navigateto&lat=mylat&long=mylon&name=myname - but did not work. Only tomtom app is starting.
Even when I try to go over the http://addto.tomtom.com API, tomtom does only start, no action in adding and POI or chance to navigate to.
Codesniplet:
NSString* launchurl = [NSString stringWithFormat:#"tomtomhome://geo:action=navigateto&lat=%.8f&long=%.8f&name=%#", myEntry.getLon, myEntry.getLat, myEntry.name];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[launchurl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
Any suggestions?
I used Tomtom to send me an email from the route planning option on my iPhone. In that email is a tomtomhome:geo link which I used.
To test I clicked on the link on my Mac in Safari, and obviously nothing happened. Then I saved the link as a bookmark, which immediately is synced to my iPhone using MobileMe. I clicked on the bookmark on my iPhone Safari browser and viola Tomtom opens with a map centred to the location in the link. It pops up with a balloon with the links name, and an right arrow allows me to choose first option "Navigate there"
The link generated is:
tomtomhome:geo:action=show&lat=26.123456&long=28.123456&name=linkname