0
votes

How to identify whether some particular application is already installed in my device or not through xamarin forms? (I want to achieve in android and ios).

Explanation :

In native windows application I have used one service which give me following data (App Name, App Icon Image, App Id, Publisher Id, Version name).

I have checked whether particular application is already installed in my device or not through App Name, App Id, Publisher Id.

Suppose app is installed then I checked version of the application if its fully updated then "Launch" button display and if it is not then "Update" button display.

If application is not installed then "Install" button display and this button redirect me directly through play store.

Same thing I want achieve in android and ios through xamarin forms.

which things are required through service for android and ios?

How to redirect directly to play store in android and ios?

1
Can you tell some app name like you wish to open, example like facebook or something..?Himanshu Dwivedi
No, Not like that. I am giving you one example, suppose one organization developed 10 apps and published. If user install any one of them then in home page of the app I want to display list of all app where 1 app as installed and other 9 with "install" button. all name comes from service. (App name is any thing). App id is also there.RMR
if it is possible for facebook app then it also helpful for me.RMR

1 Answers

0
votes

Method 1:

Try using App Links. You need to install the Rivets component from the Component Store. You can handle the navigation to play store if not installed and else browser based on your URL.

Rivets.AppLinks.Navigator.Navigate("http://any.old.url");

Your app will now attempt to Navigate to another installed app for the URL using App Links, or will fall back to usingUIApplication.OpenUrl in ios/or will fall back to using an intent with a view action in Android, if no App Link meta data is found, or no apps for the metadata are installed.

Method 2:

For example I have handled the situation for facebook app to open a page from my xamarin app but not by using App Links.

Device.OpenUri(new Uri("fb://page/page_id")); // Launch the page in facebook app (if facebook app is installed) from my application.

The above code line when executed, will open the specified facbook page in facebook app. Notice "fb://page/page_id" this is the intent with specific uri provided from facebook. You can read more about it here.

Use Plugin.Share to use CrossShare to open a browser cross-platform from your xamarin app. This I have used below.

The above code will throw an exception if facebook app is not installed, then you probably need to redirect to the play store of Android or the app store of Apple.

For Android:

CrossShare.Current.OpenBrowser("https://play.google.com/store/apps/details?id=com.facebook.katana");

Here com.facebook.katana is the package name of facebook app in android. You can replace with your application's package name if registered on playstore. This will automatically launch in playstore not in browser.

In case of IOS redirect to App store:

CrossShare.Current.OpenBrowser("https://itunes.apple.com/us/app/facebook/id284882215/");

Here id284882215 is the app id of facebook on Apple's app store.