黑莓 - setPayloadText 不起作用
我试图在调用 invokeApplication 之前使用 TexTMessage 接口准备 SMS,以便使用预填充的消息打开 SMS 应用程序。 地址(电话号码)工作正常(已预先填写),但邮件正文却不行。确实看起来setPlayloadText方法没有效果。
这是我的代码
messConn = (MessageConnection)Connector.open("sms://");
TextMessage sMess=(TextMessage)messConn.newMessage(MessageConnection.TEXT_MESSAGE);
sMess.setAddress("sms://123456789");
sMess.setPayloadText(new String("ahah")); //doesn't seem to work
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(sMess));
感谢您的帮助。
文森特
I am trying to use the TexTMessage interface to prepare a SMS before invoking invokeApplication in order to open the SMS application with a prefilled message.
The address (phone number) works well (it's prefilled) but the message body doesn't. Indeed it seems that the setPlayloadText method has no effect.
Here is my code
messConn = (MessageConnection)Connector.open("sms://");
TextMessage sMess=(TextMessage)messConn.newMessage(MessageConnection.TEXT_MESSAGE);
sMess.setAddress("sms://123456789");
sMess.setPayloadText(new String("ahah")); //doesn't seem to work
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(sMess));
Thanks for your help.
Vincent
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
存在一个错误,导致在某些操作系统版本中无法填充文本正文。您可以通过将消息内容存储到剪贴板,然后在等待短信应用程序出现一秒钟左右后注入粘贴操作来解决这个问题。有点狡猾,但这是在这种情况下你唯一能做的事情。
或者,您可以创建自己的发送文本屏幕来为用户执行此操作。您可以查看 http:// supportforums.blackberry.com/t5/Java-Development/Different-ways-to-send-SMS-messages/ta-p/445070 其中提供了有关如何以编程方式发送消息的说明。请注意,如果您使用此方法,则应同时使用这两种方法,其中一种方法是第一种方法失败时的后备方法。
There is a bug that prevents the body of the text from being populated in certain OS versions. You can get around it by storing the contents of the message to the clipboard, and then injecting a paste operation after waiting a second or so for the SMS app to come up. A little dodgy, but it's about the only thing you can do in that situtation.
Alternatively, you can create your own send-text screen that does this for the user. You can take a look at http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-send-SMS-messages/ta-p/445070 which gives instruction on how to programmatically send the message. Note that if you do this method, you should use both, with one being a fallback method if the first fails.