I want to find whether a particular app is installed on device and retrieve the version number of that app. How can i do this in Xamarin forms? I need to implement this in both Android and iOS.
3
votes
1 Answers
6
votes
iOS:
Version:
Retrieving the version number of other app in iOS is impossible.
Is installed:
But, if you know the URL Scheme of a third party app, you can use canOpenURL(_:) to check if that app is installed on the device. If it returns true
, it means the app is installed.
For example, you can check if Microsoft Outlook app is installed on the iOS device via the link ms-outlook://
by using the following code snippet:
if(UIApplication.SharedApplication.CanOpenUrl(new NSUrl(new NSString("ms-outlook://"))))
{
//YOUR CODE...
}
Notice that, if it is in iOS 9 or above, you have to add the LSApplicationQueriesSchemes
in the info.plist to allow the url scheme, like this:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>ms-outlook</string>
</array>
Android:
In Android, you can use PackageManager and PackageInfo to check if any app is installed and the version of it.
There're some related SO cases you can refer to: