SoFunction
Updated on 2025-03-01

c# Use xamarin to write a call program

xamarin can easily write a telephone dialing program. The following code calls the dialing function of the Android system, and a prompt message will be given before dialing.

callButton is a button used to dial. We use its click event to dial. There will be a prompt box before dialing.

 += (object sender, EventArgs e) =>
{
  // On "Call" button click, try to dial phone number. 
  var callDialog = new (this);
  ("Call " + translatedNumber + "?");
  ("Call", delegate {
      // Create intent to dial phone
      var callIntent = new Intent();
      (("tel:" + translatedNumber));
      StartActivity(callIntent);
    });
  ("Cancel", delegate { });
 
  // Show the alert dialog to the user and wait for response.
  ();
};

The above is the entire content of this article, I hope you like it.