您的位置:首页 > 移动开发 > Android开发

Forms Android SMS

2015-07-31 23:03 337 查看
forms 定义接口

using System;
using System.Collections;
using System.Collections.Generic;

namespace
{
public interface ISystemSms
{
//发送短信
void SendSms (string num, string context);
}
}

平台实现
using System;
using System.Collections;
using System.Collections.Generic;
using Xamarin.Forms;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Telephony;

using

[assembly:Dependency(typeof(SystemSms))]
namespace
{
public class SystemSms : Java.Lang.Object,ISystemSms
{
public SystemSms()
{
}

public void SendSms(string num,string context)
{
var smsUri = Android.Net.Uri.Parse("smsto:"+num);
var smsIntent = new Intent (Intent.ActionSendto, smsUri);
smsIntent.PutExtra ("sms_body", context);
((Activity)Forms.Context).StartActivity (smsIntent);
//Application.Context.StartActivity (smsIntent);

}
}

}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: