如何在短信应用程序中查看从我的应用程序内发送的消息?
我刚刚创建了一个很酷的应用程序,可以与短信一起使用。 您只需向手机发送一些短信,它就会回复您的位置和一些方便的信息。对我的朋友很有用,我只是告诉他们给我发一条带有“WhereIs”的短信,我会自动回复您我的位置
对于回复,我使用:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, position, pi, null);
这很好。
不幸的是,所有发送的短信都没有出现在我的短信应用程序中,因此我不知道短信已发送。
我真的很想知道问我的人得到了什么答案。
因此,要创建一个正确的问题:
有没有办法“告诉”短信应用程序我在应用程序中发送了一些短信?
非常感谢您的任何答复。
I have just created a cool app that work with SMS.
You have just to send some SMS to your phone and it reply with location and some handy stuff. Usefull for my frieds, I just told them send me a SMS with "WhereIs" and I will automatically reply you with my position
For the response, I use:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, position, pi, null);
And that is very fine.
Unfortunately, all sent SMS does not appear in my SMS application, so I don't know that a SMS has been send.
I really would like to know what the people asking me are receiving as answer.
So, to create a correct question:
Is there a way to "tell" the SMS app that I sent some sms in my application?
Thank a lot for any answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只是一条信息:您应该始终使用“android.telephony”包中的 SMSManager,因为“android.telephony.gsm”包中的 SMSManager 已被弃用。
对于您的问题:您可以使用您用意图“pi”指定的活动中的“Activity.RESULT_OK”全局来检查消息是否已成功发送。请参阅 此处。
Just an information: You should always use the SMSManager from the "android.telephony"-package, because the one from the "android.telephony.gsm"-package is deprecated.
To your Question: You can check if the message was successfully send by using the "Activity.RESULT_OK"-global in the Activity you specified with the Intent "pi". See here.
您可能希望将该消息添加到 Android 内置的“已发送文件夹”(又名“content://sms/sent”)中。我还没有尝试过,但我想它应该有效。因为如果我没记错的话,所有消息应用程序都会从这个位置获取您发送的消息。尝试一下。请检查答案是否有效。
You would want to add that message to Android's built in "Sent folder" aka "content://sms/sent". I have not tried it but I guess it should work. Cause if I am not wrong all the messages app would get your sent messages from this location. Give it a try. Please check as answer if this works.
但 prblm 是它显示为由传入号码发送的收件箱消息......而不是作为发送的项目......
but the prblm is tht its showing as the inbox message that is sent by the incomingNumber...not as the sent items....