Is it possible to discover launch URLs of installed apps on an iOS device?
(AudioBus does know which apps are installed, somehow, and its "Select Input" box shows just those that are available for input)
Likely what AudioBus does is use -[UIApplication canOpenURL:] to check if a URL handler is registered on the device. It requires a list of URL schemes beforehand tho (AudioBus seems to require developers to register apps, as does Facebook), and any app can claim to handle any URL as far as I can tell, so it's never a definitive solution...
Example:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"googlechrome://example.com"]]) {
// Google Chrome is likely installed on the device
}
You might also want to look at inter-app audio introduced with iOS 7 for the topic of sharing audio between apps.
Related
In my app I'm showing list of applications.Is it possible to find that the array of applications are installed or not in iPhone.
If any possibility is there anyone please provide related code in swift to check the array of applications is installed or not in iPhone.
In the old times you could have used canOpenURL with a library like iHasApp. This only works for apps that register custom deep link schemes, but it was capturing the majority of important apps.
But since iOS 9 there seems to be a limitation to this approach - see How to reset `canOpenURL` limit in iOS9?
In general your app is not allowed to know what else is installed in the system for privacy reasons.
From your sandboxed application
By default from an Application Layer, you are not allowed to use the private API's to check what other applications are installed on your device.
Workarounds
If the target third-party app supports URL schemes. You can check the url scheme they implement using [UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"someScheme://randomText"]] .
(Not recommended)Take a look at private frameworks like /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices LSApplicationWorkspace . There is a method called allInstalledApplications in LSApplicationWorkspace which should work, check runtime headers for more info.
Off topic ~ For MDM devices
Using Mobile Device Management (MDM) protocol, you can use InstalledApplicationList command to get the array of installed applications on the target device. The following is the response for the said MDM command.
Lets say you have a sort of a news stand kiosk app where you offer interactive magazines for download. Our newer mags are HTML5-based where we download the individual issues compressed from the server, decompress them and launch them in a (inappbrowser) modal window. Our older mags are basically individual native apps.
Could the older native mags (IPAs) also be downloaded from within the kiosk and launched somehow? Is this technically possible (and allowed at the same time)? Either launching it as a separate process/app or inline i.e. somehow from within the context of a kiosk application? Is that even possible launching an app within an app?
Of course if needed to support the process we could reexport all older apps with correct provisioning, etc. and they (in-apps) would be made available for the review process. Just looking for options on whats technically possible currently.
Thank you!
Assuming:
The older native mags can be downloaded from the AppStore
They each support a different URL scheme (e.g. mymagazine1://, mymagazine2://)
you can do the following:
When the user indicates he/she wants to open magazine 1, evaluate
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"mymagazine1://"]]
If it is YES, open the app with
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"mymagazine1://"]]
If it is NO, open the App Store app for the specific magazine. This can be done in the same way as described in this question.
You cannot open these apps 'inside' your main app, that is simply not possible.
I'm not sure if Apple will approve these apps though - they could ask you to provide this content via Newsstand.
How can i get a list of all my iphone apps (even pointers for each app will be helpful)?
I'm developing an app which contain some screen that should have a list of all my installed apps (with their icon) and the option to select one to launch it in the future depends in other function of mine.
Thanks alot!
There's no way to accomplish this, because each app is sandboxed.
You would be able to determine if select apps are installed if they have custom URL schemes. For example, the Facebook app can be launched with the custom url scheme "fb://", but these aren't guaranteed to be unique, so a different app could use a scheme that's well known to belong to another app. Also not all apps have a custom URL scheme, and you would need some master list (that would need to be constantly updated to be accurate) to check for the presence of each. So you could maybe detect a select list of well-known apps with custom URL schemes, but never get a list of all of them.
If you just wanted to detect your own apps, you could have custom URL schemes that are almost certainly going to be unique set for each app, and check for those.
You could also jailbreak your device, but I'm assuming you want this functionality in an app that is distributed on the app store, so you wouldn't be able to add functionality that requires a jailbreak to work.
EDIT:
Here's an example showing detection of the Facebook app being installed:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"fb://"]])
{
// Handle the Facebook app being installed
}
Note however, this won't give you any information about the app. Any app developer could add the "fb://" custom url scheme to their app, which would make this falsely detect it.
If you want to find lists of custom url schemes for iOS apps, just search in Google.
another way to look at this is to present the user with all of your app in the appstore. If they have any apps installed on their device then in iOS 7 they will see a button called "Open" next to each of them.
For example you can have a UITableViewCell or a UIButton that says "Checkout Our Apps". In the code you would add this.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms://itunes.com/apps/sixaxisllc"]];
Replace SixAxis LLC with your iTunes developer name and when users click on it, it will launch AppStore app with only your apps are shown. (With Open or price amount next to each of them)
NOTE: test this on actual device and not in simulator
Because of the Sandboxed environment, all you can do is test if it you can open a custom URL.
Akosma Software maintains a list of popular Url on his wiki: IPhone URL Schemes.
I have seen that there are known apps, such as Twitter and Facebook, that display a "Turn Off Airplane Mode or Use Wi-Fi to Access Data" message within an alert view, with a button that switches to the Settings app, when no network is detected as the app goes foreground. This message is the same in all apps where I saw it, is this alert view a kind of predefined one that you can use? Similar to the one displayed when checking locationServicesEnabled...
I found some posts dealing with this issue some time ago, for example:
iOS UIAlertView button to go to Setting App, and it seems (or seemed) to be a way to read the values in the iOS' Settings app, but I couldn't find any of this in the Apple Developer's documentation... is there any public API for accessing those values? Would an app be rejected if accessing them as in the post I linked?
Thanks in advance
Till iOS 5.0, you can use the URL scheme to open the Settings App from third-party apps using the URLScheme like:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
Unfortunately, iOS 5.1 and iOS 6 not supports this feature.
You can use the Reachability for checking the Wi-Fi state.
For displaying the default alertview when the Wi-fi is off or in AirPlane mode you can use the Application uses Wi-Fi flag in the info.plist
Refer InfoPlistKeyReference for details:
UIRequiresPersistentWiFi
“Application uses Wi-Fi”
Specifies whether this app requires a Wi-Fi connection.
Does iOS offer a way for an app to query the device for information about what other apps are installed/running?
All ios apps are sandboxed so this wouldn't be possible on a non-jailbroken device
There are a few options.
First, you can lookup for the specific process name of the app, but this may be prone to error as unrelated apps may be running using the same process name, for example, I've seen both the Batman and Dark Meadow game share a similar process name: UDKGame.
Secondly, using the URL scheme. This method is useful if you know what apps you are looking for and you know that this particular app implements the URL scheme. You can do a simple canOpenURL and find out if that app is installed.
I use the second method a lot to collect the URL schemes for use in my app, AppSwitch.