zoukankan      html  css  js  c++  java
  • Forms Android SMS

     1 forms 定义接口
     2 
     3 using System;
     4 using System.Collections;
     5 using System.Collections.Generic;
     6 
     7 namespace 
     8 {
     9     public interface ISystemSms
    10     {
    11         //发送短信
    12         void SendSms (string num, string context);
    13     }
    14 }
    15 
    16 平台实现
    17 using System;
    18 using System.Collections;
    19 using System.Collections.Generic;
    20 using Xamarin.Forms;
    21 
    22 using Android.App;
    23 using Android.Content;
    24 using Android.Runtime;
    25 using Android.Views;
    26 using Android.Widget;
    27 using Android.OS;
    28 using Android.Telephony;
    29 
    30 using 
    31 
    32 [assembly:Dependency(typeof(SystemSms))]
    33 namespace 
    34 {
    35     public class SystemSms : Java.Lang.Object,ISystemSms
    36     {
    37         public SystemSms()
    38         {
    39         }
    40 
    41         public void SendSms(string num,string context)
    42         {
    43             var smsUri = Android.Net.Uri.Parse("smsto:"+num);
    44             var smsIntent = new Intent (Intent.ActionSendto, smsUri);
    45             smsIntent.PutExtra ("sms_body", context);  
    46             ((Activity)Forms.Context).StartActivity (smsIntent);
    47             //Application.Context.StartActivity (smsIntent);
    48 
    49         }
    50     }
    51 
    52 }
    View Code
  • 相关阅读:
    NET CORE 数据库迁移
    VUE3.0 解析svg文件
    关于ElementUI的样式不生效
    git命令
    vue 2.x的跨域问题
    Putty 重新启动 linux sqlserver服务
    aspnetcore之session
    Syncfusion 在 core 的架构
    TortoiseSVN创建/合并分支
    正则表达式知识点整理
  • 原文地址:https://www.cnblogs.com/techidea/p/4693390.html
Copyright © 2011-2022 走看看