How to find OpenVPN is installed or not - ios

I searched for OpenURL scheme to find OpenVPN is installed or not.
so far no luck.
is there any other way I can verify?

OpenVPN Connect 1.0.6 and higher installs the openvpn:// URL scheme and can be detected with the following code:
BOOL installed = [application canOpenURL:[NSURL URLWithString:#"openvpn://"]];
Reference

In iOS < 9 you can easily check wether an Application is installed or not, in case you know the exact URL scheme.
For this you could use the functions [[UIApplication sharedApplication] canOpenURL:yourURL] and [[UIApplication sharedApplication] openURL:yourURL]. This functions were used by different Applications to check which Apps are installed to provide custom Ads.
With the Update to iOS 9 this functionality is limited. "Starting on iOS 9, apps will have to declare what URL schemes they would like to be able to check for and open in the configuration files of the app as it is submitted to Apple."(Awkward Hare - Quick Take on iOS 9 URL Scheme Changes)
Edit: URL scheme provided by: Durai Amuthan.H
Best Regards

Related

How can I check programmatically that list of applications are installed or not in iPhone

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.

How to check if a user installed my app from my another app? iOS (Unity)

I have 2 apps and I want to know if in my app 1, the app 2 is installed (and in my app 2, check if my app 1 is installed).
I know the function :
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]]
But the problem is I have to add the urls scheme in LSApplicationQueriesSchemes in my Info.plist but maybe tomorrow I want to develop a third application and I don't want to rebuild all my apps and include my new url scheme inside my application 1 and 2.
Is it possible to check if an user has one of my application by the developer ID or something like that? Without rebuild new version of my apps just for adding 1 url scheme when I release a new app?
Thank you
You can have all your apps use the same "App Group" (google more information on how to set it up, it's easy) and you can create a NSUserDefaults suite using that group identifier.
On launch, each app could write the Appname Installed key to that NSUserDefaults suite and since it's a shared suite between your apps, others could read the value and know if Appname is installed.
The downside of this is that there's no way for your app to know when it's being uninstalled, so if it's installed once the key will show up there even if the app was removed.
The best way to do this is using URL schemes. Each of your app should register a URL scheme it can handle, and then from the other app you call canOpenURL(_:) on UIApplication to test if your app is installed.
Example:
If you have MyApp1 which has registered the URL scheme myapp1://, from your other app you can:
UIApplication.shared.canOpenURL(URL(string: "myapp1://")!)
Pay special attention to the LSApplicationQueriesSchemes key you need to add to your Info.plist. This is needed for this to work and is mentioned on the documentation page I linked above.
Contrary to the application group approach, this will correctly identify when your app is uninstalled.

How does main app know when an sub app has been installed in ios?

How does an app know when an app by the same developer has been installed in iOS?
You can check by openURL method which will help to check app installed in your device or not.
Objective-C:
UIApplication *application = [UIApplication sharedApplication];
NSLog(#"App installed %d",[application canOpenURL:[NSURL URLWithString:#"AppName://"]]);
[application openURL:[NSURL URLWithString:#"AppName://Test"] options:#{} completionHandler:^(BOOL success) {
NSLog(#"Open result %d",success);
}];
Swift:
let appURL = "AppName://extra_param_for_launchscreen"
let URL = NSURL.init(string: appURL)
if UIApplication.sharedApplication().canOpenURL(URL) {
UIApplication.sharedApplication().openURL(URL)
}
by canOpenURL you can check app installed or not.
Note : for iOS 9.0 and grater you need to add
LSApplicationQueriesSchemes in your info.plist file with your app
schema name to white list your app and get installed app status or open app.
Hope this will helps you.
Previously, we can use concept of URL Schemes to find out whether the app we are looking for is installed or not.(By using canOpenURL method). But recently, apple removed this functionality to know whether app installed or not from iOS9 due to privacy policy of apple. So, now you cannot find out the sub app is installed or not in any manner due to security reasons.
Following links might be helpful to you:
canOpenURL to query url schemes
Privacy and URL Schemes in iOS9

Discover Launch URLs (iOS)

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.

Detect app installation with StoreKit

iOS6 introduced StoreKit framework which is designated for interacting with the AppStore from within the app.
I easily managed to direct the user to a specific app, the question is how can I detect whether the user actually installed the app I redirected him to?
This is usually done by calling -canOpenURL: on UIAplication object like this:
NSURL *appURL = [NSURL URLWithString:#"fb:"];
BOOL appInstalled = [[UIApplication sharedApplication] canOpenURL:appURL];
But you need to know what URL scheme does the second app open. It is declared in Info.plist file by the app developer.
There is an open source framework called "iHasApp" avaiable that can detect installed apps.
Git Repository: iHasApp

Resources