Mik*_*ish 7 c# xamarin.ios xamarin.android portable-class-library xamarin.forms
我正在开发Xamarin.Forms项目,iOS,Android和Windows Phone.
我的应用程序要求用户输入短信和电话号码然后提交,我需要发送短信到电话号码.
我更喜欢为所有平台都有一个实现.
你可以使用这个开源插件Xam.Plugins.Messaging https://github.com/cjlotz/Xamarin.Plugins
这是提供的示例(来自https://github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/Details.md):
// Make Phone Call
var phoneDialer = CrossMessaging.Current.PhoneDialer;
if (phoneDialer.CanMakePhoneCall)
phoneDialer.MakePhoneCall("+272193343499");
// Send Sms
var smsMessenger = CrossMessaging.Current.SmsMessenger;
if (smsMessenger.CanSendSms)
smsMessenger.SendSms("+27213894839493", "Well hello there from Xam.Messaging.Plugin");
var emailMessenger = CrossMessaging.Current.EmailMessenger;
if (emailMessenger.CanSendEmail)
{
// Send simple e-mail to single receiver without attachments, bcc, cc etc.
emailMessenger.SendEmail("to.plugins@xamarin.com", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin");
// Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc.
var email = new EmailMessageBuilder()
.To("to.plugins@xamarin.com")
.Cc("cc.plugins@xamarin.com")
.Bcc(new[] { "bcc1.plugins@xamarin.com", "bcc2.plugins@xamarin.com" })
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.Build();
emailMessenger.SendEmail(email);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7651 次 |
| 最近记录: |