'No Activity Found To Handle Intent - phone dialer

I'm trying to make a dialer intent and getting this error: Android.Content.ActivityNotFoundException: 'No Activity found to handle Intent { act=android.intent.action.DIAL dat=tel:xxxxxxxxxx }' This is my code:

Intent intent = new Intent();
intent.SetAction(Intent.ActionDial);
Android.Net.Uri uri = Android.Net.Uri.Parse("tel:" + "1700700848");
intent.SetData(uri);
StartActivity(intent)

I have tried to find a solution to this problem but nothing worked.



Solution 1:[1]

Try this code i think this will help you

Android.Net.Uri uri = Android.Net.Uri.Parse("tel:" + "1700700848");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);

this question is already answered here

Solution 2:[2]

Well, there are two ways to do this in Xamarin Android as of now:

  • Using intent:

    Intent intent = new Intent();
    intent.SetAction(Intent.ActionDial);
    Android.Net.Uri uri = Android.Net.Uri.Parse("tel:" + "1700700848");
    intent.SetData(uri);
    activityContext.StartActivity(intent);
    
  • Xamarin Essentials:

    In your Manifest add:

If your project's Target Android version is set to Android 11 (R API 30) you must update your Android Manifest

  <queries>
  <intent>
  <action android:name="android.intent.action.DIAL" />
  <data android:scheme="tel"/>
  </intent>
  </queries>

And create a method like below:

 public void PlacePhoneCall(string number)
{
    try
    {
        PhoneDialer.Open(number);
    }
    catch (ArgumentNullException anEx)
    {
        // Number was null or white space
    }
    catch (FeatureNotSupportedException ex)
    {
        // Phone Dialer is not supported on this device.
    }
    catch (Exception ex)
    {
        // Other error has occurred.
    }
}

Then use it something like this: PlacePhoneCall(399287934);

Solution 3:[3]

In Xamarin, you can use Xamarin.Essentials: Phone Dialer. Just add a simple configuration under the AndroidManifest.xml asking price and you can use it.

More information about it can refer to: https://docs.microsoft.com/en-us/xamarin/essentials/phone-dialer?tabs=android.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ajay K S
Solution 2 Dharman
Solution 3 Wen xu Li - MSFT