机器人发短信是短信线程(没有GUI)可见 [英] Android send SMS which is visible in SMS thread (no GUI)
问题描述
我需要:
- 发送短信,没有GUI交互(选择客户端发送短信了)
- SMS具有可见从查询线程的内容://彩信,短信/通话/+ threadId的
What I need:
- Send SMS with no GUI interaction (choosing a client to send SMS is out)
- SMS has to be visible in a thread queried from "content://mms-sms/conversations/"+threadId
目前我使用SmsManager的:
Currently I'm using SMSManager:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phone, null, message, null, null);
有没有办法在所有设备要做到这一点考虑他们每个人都有不同的短信应用程序。先谢谢了。
Is there any ways to do this across all the devices considering each of them has a different SMS app. Thanks in advance.
推荐答案
只要想通了,你可以使用ContentResolver的插入短信,记得添加权限: 使用-权限的Android:名称=android.permission.WRITE_SMS
Just figured it out, you can use ContentResolver to insert the SMS and remember to add permissions: "uses-permission android:name="android.permission.WRITE_SMS"
ContentValues values = new ContentValues();
values.put("address", phone);
values.put("body", message);
getContentResolver().insert(Uri.parse("content://sms/sent"), values);
这篇关于机器人发短信是短信线程(没有GUI)可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!