android.telephony.SmsManager 短信笔记
android 几种发送短信的方法
http://www.oschina.net/question/163910_27409
<uses-permission android:name="android.permission.SEND_SMS"></uses-permission>package com.union.matchfighter; import android.app.PendingIntent;
import android.telephony.SmsManager; public class PSMS { /***
* 发送信息
*/
public void SendMessage(String number, String scAddress, String content, PendingIntent sentIntent, PendingIntent deliveryIntent)
{
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(number, scAddress, content, sentIntent, deliveryIntent);
} /***
* 根据号码和内容发送短信
*/
public void SendMessage(String number , String content )
{
System.out.println("1111 SendMessage");
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(number, null, content, null, null);
System.out.println("1111 SendMessage");
} static PSMS _instance ;
public static PSMS getInstance()
{
if( _instance == null) _instance = new PSMS();
return _instance ;
} /* 需要将本段放到主UI上去
public void PSMS_SendMessage( String number, String content ) {
PSMS.getInstance().SendMessage(number, content); }
*/
}
using UnityEngine;
using System.Collections; public class PSMS { /// <summary>
/// 发送短信
/// </summary>
/// <param name="number"></param>
/// <param name="content"></param>
public void sendMessage(string number, string content)
{
if (Application.platform == RuntimePlatform.Android)
{
sendMessageAndroid(number, content);
}
else
{
Debug.Log(Application.platform + " : was not fix ");
}
} public void sendMessageAndroid(string number, string content)
{
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"); jo.Call("PSMS_SendMessage", number, content );
} static PSMS _instance;
public static PSMS instance
{
get
{
if (_instance == null) _instance = new PSMS();
return _instance;
}
} }
android.telephony.SmsManager 短信笔记的更多相关文章
- Android实现简单短信发送器
布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:to ...
- 使用SMSManager短信管理器实现短信群发
import java.util.ArrayList; import android.os.Bundle;import android.provider.ContactsContract;import ...
- 使用SMSManager短信管理器发送短信
import android.os.Bundle;import android.app.Activity;import android.app.PendingIntent;import android ...
- Android之发送短信和接收验证码
最近项目需求需要发送短信和接收验证码并将验证码显示在输入框中 以下是我的记录 前提---权限 <uses-permission android:name="andro ...
- android 60 发送短信
import android.os.Bundle; import android.app.Activity; import android.telephony.SmsManager; import a ...
- Android学习4—短信发送器的实现
界面预览: 由图中可以看出,此APP需要的组件有:两个TextView,一个用于显示手机号码的标题,另一个用于显示短信内容的标题. ...
- Android之发送短信的两种方式
SMS涉及的主要类SmsManager 实现SMS主要用到SmsManager类,该类继承自java.lang.Object类,下面我们介绍一下该类的主要成员. 公有方法: ArrayList< ...
- android sim 卡短信读写
因为对短信读写操作的api 被隐藏了 , 我们须要使用<Java反射机制的学习>一文中提到的反射的方法得到隐藏API . 这有一个用例大家能够下载http://zhushou.360.cn ...
- (转)Android之发送短信的两种方式
https://www.cnblogs.com/dongweiq/p/4866022.html if(TextUtils.isEmpty(number)||TextUtils.isEmpty(cont ...
随机推荐
- 4-Bom&Dom总结篇
其实Bom就是指浏览器的东西,比如弹窗啊.浏览器信息啊等 而Dom则是指文档的东西,就是浏览器里边html的东西,如元素啊.属性啊.事件什么的 但Bom的唯一顶层对象window又包含Dom的顶层对象 ...
- js的严格模式
严格模式: 严格模式这下的主要区别如下: 严格模式下的好处:
- ios 关于tableview小技巧
第一个:cell中的分割线不顶头 首先在viewDidLoad方法加入以下代码: if ([self.tableView respondsToSelector:@selector(setSeparat ...
- QDataStream对QVector的序列化
最近发现QDataStream这个好东东,序列化发送数据很方便,与大家分享一下. 客户端: line.h #ifndef LINE_H #define LINE_H #include <QStr ...
- inception cenOS 安装
inception手册http://mysql-inception.github.io/inception-document/install/ 执行命令sh inception_build.sh,ce ...
- 解决 git extensions 每次提交需要输入用户名和密码
打开git bash 输入用户名和密码 git config --global user.name "username" git config --global user.emai ...
- Hadoop Datanode 机器缺失 VD 问题修复尝试
背景: 新集群 Datanode 使用两个 SSD 做 raid 1 作为根磁盘,12 个 SAS 单独做 raid 0 作为数据盘,在机器部署完毕后,缺发现 PD slot 4 和 slot 5 丢 ...
- emoji Unicode characters
http://www.easyapns.com/iphone-emoji-alerts he complete list of iPhone emoji Unicode characters. Jus ...
- USACO 2.3 Cow Pedigrees
Cow Pedigrees Silviu Ganceanu -- 2003 Farmer John is considering purchasing a new herd of cows. In t ...
- L3-004. 肿瘤诊断
L3-004. 肿瘤诊断 题目链接:https://www.patest.cn/contests/gplt/L3-004 BFS 之前尝试使用递归dfs,提交后发现有两个段错误,发现递归层数太多,然后 ...