Launching another app in the background iOS - ios

I am certain I already know the answer to this question, but I figured it was worth an ask.
I am working on an app that uses another app's custom URL Scheme to launch it, and then send the user to a specific page in the other app. I use:
[[UIApplication sharedApplication] openURL:URLScheme];
However, due to a bug in the other app (that I have no control over), if the app isn't running in the background, the URL will launch the app, and keep it on the home page rather than sending the user to the correct page within the app. If the app is running in the background, the process works as expected. I find this to be an unfortunate user experience that sometimes a link lands them on the home page and sometimes it lands them on the correct page.
I am using a way to detect if the app is running in the background or not which is working successfully. The question here is if the app is not running in the background can I make it launch without sending the user there until it launches. Or said differently send the user there (which puts my app into background) and once a user lands on the app, then send the request again to send them to the right page?
Again, I am sure I already know the answer to this, but thought I would see what you all thought.

Related

Is there a way to get back to your application from the settings page of iphone

I have designed an app where the app needs to enable the GPS. There is a page for the user which ask use GPS? To this answer there are 2 options YES and NO. Now my concern is when user clicks on YES he should be directed to settings page and that part is done but now after enabling the GPS from this page the user should redirect to the app again but unfortunately there is no way as there is no back button in the setting page.. Please suggest what I can do in this regards?
As far as I know, the only way to open your app (aside from user tap your app or a related notification) is to do some custom url handling. but unfortunately you can't do such a thing. The other thing you can try is to:
Setup a background thread when your app goes to background
check for location service availability
if it changed to your desired value, open a custom url which in turn will open your app (you should register for hat particular url in your info.plist and such)
but There are some things to keep in mind:
Such Behavior will almost surely get your app rejected by Apple.
in iOS 9+ Apple added a new feature that will help you in this particular problem. when an app gets opened from another app (settings.app for you here) it will add a Back to xxxx in place for network indicator to help user get back were he was.
So, IMHO leave the user experience be as it is for all other applications and don't worry about how he would get back to your app.

Handling Custom URL Application Start in ios

We have link functionality in our web application that when clicked, browses to a page on our server that performs the following:
Tries to open the custom url to our ios application
If this fails, it redirects the user to our ios app store to download the app.
This actually all works perfectly well.
However, it creates a weird corner case, where after a user has done this and finished, if they come back sometime later and open their safari on the same phone, if our web link is still the active tab, it will redirect them again to our application.
The cause of this is fairly obvious, but we are struggling to come up with a solution for it. Is there any known to rectify this behavior, either through a different mechanism then I described for opening the application or through somehow killing the page simultaneously?

Phonegap how to come back to app screen and exit from app iOS

I am creating a phonegap application that posts the login information to my website. When user signs off I want to come back to my app. Do I just send the url location along with the post data so that I can come back? or there is another elegant way?
Also when user clicks on the iphone home button, I want the application to exit. Currently it just saves the session and the page and goes back directly to the page if I start the application again.
I am using adobe phonegap site to build and test the application
From your description, I assume that you are navigating the Phonegap WebView (which is running your app) to the URL of your website?
If so, at this point you no longer have an app to navigate back to - the WebView has lost its handle on your app. In order to "navigate back" to your app, you should use the InAppBrowser plugin to navigate to your website. This will allow you to return to your app after the user logs out from your website. You'll need to somehow communicate the logout from your website in the InAppBrowser WebView to your app in its WebView. You may be able to achieve this with cross window messaging.
You can't "exit" an app in iOS - the OS does not allow you to do this. The best you can do is use the resume event to detect when your app has been restored from the background, then manually reset your app to its initial state.

Does app-argument on Apple Smart Banner get passed to app on install?

I've implemented a Apple Smart Banner for my app, including a app-argument with a URL I'd like the app to open on my site. I thought that would pass through when the user installs the app, but it doesn't seem to.
The steps - user visits page, doesn't have app installed, clicks View, goes to app store, installs app and then taps Open in the App Store. The app opens, but it doesn't appear to get the app-argument passed in. Note that if they then go back to the web page, the Smart Banner now says Open and that works and passes the app-argument, just not on the first install.
Have I misunderstood what is supposed to happen? If so, this makes the Smart Banner pretty much useless for me.
Gary
From the docs:
If the app is already installed on a user's device, the banner intelligently changes its action, and tapping the banner will simply open the app. If the user doesn’t have your app on his device, tapping on the banner will take him to the app’s entry in the App Store. When he returns to your website, a progress bar appears in the banner, indicating how much longer the download will take to complete. When the app finishes downloading, the View button changes to an Open button, and tapping the banner will open the app while preserving the user’s context from your website.
It only sends the URL param if the app is opened via the banner. If it's opened via AppStore or via SpringBoard, it won't send it.
You can do it with branch.io. More info here.
tl;dr
What Branch does is generate a custom URL specific for your device and uses the same unique configuration to fetch the data when the application is opened. Thus, you need to include their SDK into your app in order to get those arguments you want to send.
Maybe this is a bug?
From: http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html
When the app finishes downloading, the View button changes to an Open button, and tapping the banner will open the app while preserving the user’s context from your website.

iOS not receiving user to user app requests

I am sending app requests from an iOS native app using Facebook SDK dialog. I have created a canvas app and set the iTunes ID (using a valid ID from a different app in the store now, since mine is not). The requests arrive at desktop www site, and show up under "App and Games>Invites from friends". But, they do not show up on iOS native Facebook app, unless I first do Facebook SSO with my app. Then, my app bookmark appears in FB, and new requests increment the counter.
How do I get the requests to show up on iOS before my app is installed? Other peculiar thing that may be related, is I get no activity under "Notifications" on iOS, only the app bookmark. On desktop, I see the Notifications globe flash with a red badge at first logon, but then the badge goes away and nothing is there, although the requests appear under "Apps and games". This seems not totally consistent as some people who have tested my app get the expected Notification behavior, but I never do on my own FB account. Could it be because if added and removed the app repeatedly for testing?
Any clues?
My problem seems to have been something fouled up in the Facebook database, probably as a result of my various misfires in early development. At some point it began working correctly without any changes on my end.

Resources