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 ...
随机推荐
- CSS样式类型
CSS样式可以写在哪些地方呢?从CSS 样式代码插入的形式来看基本可以分为以下3种:内联式.嵌入式和外部式三种.这一小节先来讲解内联式 (一)内联式样式 内联式css样式表就是把css代码直接写在现有 ...
- Python实现简单的HTTP服务器(支持文件上传下载)
1.python内置模块 SimpleHTTPServer (支持下载功能) 在对应的工作目录下,运行命令python -m SimpleHTTPServer 即可把当前目录下以共享服务的形式共享出 ...
- java中的反射机制_____
一,先看一下反射的概念: 主要是指程序可以访问,检测和修改它本身状态或行为的一种能力,并能根据自身行为的状态和结果,调整或修改应用所描述行为的状态和相关的语义. 反射是java中一种强大的工具,能够使 ...
- Centos7 安装高版本php
1. 配置yum源 查看yum源的链接是不是有效的.可以参考此链接 https://webtatic.com/projects/yum-repository/ # rpm -Uvh http://f ...
- 《Intel汇编第5版》 数组求和
一.LOOP指令 二.间接寻址 三.汇编数组求和 INCLUDE Irvine32.inc includelib Irvine32.lib includelib kernel32.lib includ ...
- 关于git提交、还原使用
1.本地修改,未提交到本地仓库,想要恢复到修改前 右键这个文件-team-show local hostory -找到某一版本-右键-get Contents 即可恢复到某一版本 2. 命令:git ...
- 安装TensorFlow的步骤
安装步骤: 1.安装虚拟机: 2.安装liunx系统: 3.安装TensorFlow. 1.安装虚拟机:虚拟机的版本是不能太低的.我使用的是:VMware-workstation-full-12.0. ...
- Linux常用命令汇总及使用方法(二)之文本编辑器VI
VI可能是在Linux中使用比较频繁的文本编辑器,如果不能熟练使用VI,在一定程度上会影响工作效率,所以在这里记录一下VI的常用命令及操作方式 在[root@test ~]# vi carrie.tx ...
- php +mysql 添加 删除 修改 insert into delete update
INSERT INTO 插入数据库 $sql = "INSERT INTO subject (uid,fun,title) VALUES (3,88,'语文')"; $query ...
- java 生成证书用于https
在jdk的bin目录下运行: keytool -genkeypair -alias "tomcat" -keyalg "RSA" -keystore " ...