I have developed a cross platform app using Phonegap (and some other technologies). Recently, we have made the switch to Xamarin, and are looking to find the equivalent of a feature we used in Phonegap.
In the phonegap build, we were using Cordova In App Browser.
We were able to open the map, phone, email, and web browsers of the users choice, pre-populated with locations, phone numbers, email addresses, and urls respectively.
This was a good solution because it enabled us to open these as the user would normally expect, and it worked on both platforms (iOS and android). This meant that on an Android device, if they were using a different browser or email client, it would open using whatever they had set to their default.
What is the Xamarin Forms equivalent of this?
Opening 'Phone' application with a number filled in
Opening 'Email' application with an email address filled in
Opening 'Web Browser' application to a specified URL
Thanks!
Consider using Xamarin Form's OpenUri() function for this. Here are some examples:
Device.OpenUri(new Uri(String.Format("tel:{0}", "+49000000")));
Device.OpenUri(new Uri(String.Format("sms:{0}", "+49000000")));
Device.OpenUri(new Uri(String.Format("mailto:{0}", "myCoolHotmail#hotmail.com")));
Related
The Xamarin.Forms application I'm currently developing must send the user to a particular location, using any maps application he has installed.
I'd like to prompt the user to choose one of any maps application that he has installed (either native app - iOS Maps or Android Google Maps, or any other application, like Waze).
The Device.OpenUri(new Uri(request)); works fine but it just opens the native app, without showing available apps.
Is there a way I can do this?
There is no way in iOS to get list of applications that displays map.
However you can display your own list of application that supports displaying map using DisplayActionSheet()
then you can show or hide an application from that list by checking if application is installed on users device or not.
In iOS this can be done by CanOpenURL()
see documentation.
Example,
To check if google maps is installed or not you can do
UIApplication.SharedApplication.CanOpenUrl(new NSUrl("comgooglemaps://"));
to make it work you need to declare it in info.plist file like
<key>LSApplicationQueriesSchemes</key>
<array>
<string>comgooglemaps</string>
</array>
I have a MVC application written in C# that supports Mobile view. I would like to record the stats on the number of users accessing the website from Mobile Phone (can be any phone) vs Computer(assuming PC/Mac), is there any way to do this?
Additional info: I need to display this stats to the users on the website.
HttpCapabilitiesBase.IsMobileDevice
Gets a value indicating whether the browser is a recognized mobile device. (Source - MSDN)
Is it possible to get a list of the installed apps which provide Map functionality?
In the maps settings menu, you can select which app should be the default one for voice navigation - in that list, my phone displays HereDrive+ and Windows Phone Maps.
How is it possible to search for apps like this? Is such API open or that list result was acquired using a restricted API?
Not a correct answer, but maybe the way you should use this is by using the ms-drive-to or ms-walk-to Uri scheme! When you use those, the phone itself will launch HERE drive if it is present, otherwise Bing maps!
My guess, in the future the user will be able so set this as an option, that he can indicate what default map app he wants to use in general. But for now it's default Bing or HERE if that is installed when using the given URI scheme.
Get the needed example code and usage on MSDN here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj710324(v=vs.105).aspx
There is no public API to list apps like this. The referenced settings menu is part of the OS not an exertion point for apps.
Apps are blocked from setting information like this from other apps or the OS.
Basically I want to achieve the same fucntionality which you normally see in android or ios devices. So if I click on login it should open facebook application(not webview) if facebook is installed but in case app is not installed it should open webview.
Currently it shows me a message do you want to search on store which I don't want.
Any help will be highly appreciated.
Thanks
Vinod
Windows Phone SDK only has the API to launch an app from another app which wouldn't work in your case since you would not be able to share session tokens.
Your best approach to achieving this would be to try out the third party Facebook SDK for .NET. Take a look at the Login API which seems to provide the ability to invoke the facebook application on the app and if not available would take the user to the store (LoginBehaviorApplicationOnly - Windows Phone 8.1).
I understand you would like to bring up the WebView if app isn't available but this SDK doesn't seem to have that functionality. You could contribute to the project or request a feature addition.
Hope this gives you a good start?
My ios application has using a custom url scheme. I want to open application from link in email. But, i want to send one link for all platforms (desktop/mobile). If user clicks the link from his ios device, i want to detect it and open my application. If application is not installed in ios device, again i want to detect it and redirect the user to app store. But, i also want to open my desktop site when the user clicks the link from desktop.
I need some methodology to detect whether the user installs he application in my server side (which is coded in .net/c# framework), then i need to take some actions.
Thanks in advance.
Prepare and share link with http scheme to your server and use user agent to detect platform (PC/iOS) server side. Then follow the answer https://stackoverflow.com/a/1109200/2714032