简体   繁体   English

以编程方式发送SMS而不在Messaging App中显示

[英]Programmatically Send SMS without it showing in Messaging App

Is there a way to programmatically send sms messages without them showing in the Messaging app? 有没有一种方法可以通过编程方式发送短信,而不会在“短信”应用中显示它们? I am using the following code to send SMS: 我正在使用以下代码发送短信:

    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage("number", null, "message", null, null);

And the messages are showing in the default Messaging app aswell as Google Hangouts. 邮件会显示在默认的“短信”应用以及Google环聊中。 For my application it would be ideal for the messages not to show up, as they are simply sending code to a GSM module, and they just fill up the users Messaging app. 对于我的应用程序,不显示消息是理想的,因为它们只是将代码发送到GSM模块,而它们只是填满了用户消息应用程序。

If you aren't sending real texts, you should probably send a port based SMS which won't be added to the messaging DB. 如果您不发送真实文本,则可能应该发送基于端口的SMS,该SMS将不会添加到消息传递数据库中。 But if you can't, you need to delete it from the sms content resolver. 但是,如果不能,则需要从sms内容解析器中将其删除。

ctx.getContentResolver().delete(Uri.parse("content://sms/inbox"), {"body"}, messageBodyToDelete);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM