is there anyway to make a phone call directly without opening the dialler in xamarin.forms?
if (device.PhoneService != null) {
Device.OpenUri(new Uri("tel:123123123"));
}
using Xamarin. Essentials; The Phone Dialer functionality works by calling the Open method with a phone number to open the dialer with. When Open is requested the API will automatically attempt to format the number based on the country code if specified.
Essentials Reference, Choose Browse and Search Xamarin. Essentials, select the package and select all the projects (portable, Android, UWP) and install it. Add the Label, Entry and Button controls in Mainpage. Xaml for displaying Title, phone number and call now.
Xamarin. Essentials provides a single cross-platform API that works with any iOS, Android, or UWP application that can be accessed from shared code no matter how the user interface is created. See the platform & feature support guide for more information on supported operating systems.
Use fast Renderers Fast renderers reduce extensions and rendering the cost of controls on android by flattering the resulting native control hierarchy. It also improves performance by creating fewer objects, which turns results in a less complex visual tree and memory use.
When we code to start a voice call, we must be aware of DependencyService in Xamarin.Forms.
DependencyService in Xamarin.Forms provides access to the native functionality and some platform-specific implementations of the iOS, Android and Windows Phone SDKs from your PCL or Shared Project.
To start a voice call there are some platform-specific implementations and permissions.
(source: netdna-cdn.com)
(source: netdna-cdn.com)
Android implementation: Before implementing the interface in Android don't forget to set some permissions in AndroidManifest.xml. These permissions are necessary for invoking a voice call in Android.
(source: netdna-cdn.com)
After setting the permissions we must implement the interface using a small class PhoneCall_Droid.cs.
(source: netdna-cdn.com)
Refer Sample for iOS & Windows Implementation.
(source: netdna-cdn.com)
Simply use the messaging plugin to do this from shared code. Works great: https://github.com/cjlotz/Xamarin.Plugins
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With