Android调用系统发送短信(短信权限介绍)

调用系统短信 直接进行发送短信

第一步 添加权限

	<!--  发送消息-->
    <uses-permission android:name="android.permission.SEND_SMS"/>
    <!--  阅读消息-->
    <uses-permission android:name="android.permission.READ_SMS"/>
    <!--  写入消息-->
    <uses-permission android:name="android.permission.WRITE_SMS" />
    <!-- 接收消息 -->
    <uses-permission android:name="android.permission.RECEIVE_SMS" />

注意:这里我们用到的权限只有发送消息和写入消息,其他三个可以不添加

第二步 跳转发送短信

Uri smsUri = Uri.parse("smsto:10086");//指定发送人
Intent intent = new Intent(Intent.ACTION_SENDTO, smsUri);
intent.putExtra("sms_body","给我唱首歌");//指定发送内容
startActivity(intent);

猜你喜欢

转载自blog.csdn.net/qq_28643195/article/details/107936287