Monitor message sent status launched by Intent= new Intent(Intent.ACTION_SEND)

谁说胖子不能爱 提交于 2020-01-05 10:32:51

问题


I am looking for a way to monitor the sent status of a MMS message started by Intent.ACTION_SEND so that I can return to my original activity upon the message being sent. Currently Im using startActivityForResult() with a request code to start it so theres something to return and display a toast with and I'm also using Intent.putExtra("exit_on_sent", true) so that it exits the default messenger and returns to the original activity when the Send button is pressed but that only gives the illusion that it sent the message and doesn't actually monitor and wait for it to be sent. I have found examples that monitor sms messages that use the smsManager, pending intents, and broadcast receivers, but being a noob I'm uncertain if thats the approach I should use. Any guidance would be appreciated.


回答1:


I am looking for a way to monitor the sent status of a MMS message started by Intent.ACTION_SEND so that I can return to my original activity upon the message being sent.

That is not possible. First, you have no control over what activity the user chooses to handle your ACTION_SEND. Second, it would be up to the authors of that other activity how to implement a "send" operation, and how they do that is none of your business.

Currently Im using startActivityForResult()

ACTION_SEND is not designed for use with startActivityForResult(); you will not generally get a result.

I'm also using Intent.putExtra("exit_on_sent", true)

Whatever that is, that is undocumented, unsupported, and generally ignored by most implementers of ACTION_SEND.



来源:https://stackoverflow.com/questions/16628006/monitor-message-sent-status-launched-by-intent-new-intentintent-action-send

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!