Android:是否有在任何 Android 设备上发送彩信的通用方法?
此代码适用于具有本机 Android 系统的普通 Google 设备。但是 htc sense 设备上的列表中没有 MMS 应用程序,我不知道 Motorola Blur 等:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/png");
emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_intent_name)));
此代码适用于 htc sense,但不适用于选择器,我真正需要的是:
Intent sendIntent = new Intent("android.intent.action.SEND_MSG");
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
sendIntent.setType("image/png");
context.startActivity(sendIntent);
但我不知道如何将此代码示例组合在一起,我不知道如何以编程方式确定 Htc Sense ui。支持不同类型设备的正确方法吗?
谢谢您的解答。
This code works on the plain google devices with native android system. But there is no MMS app in the list on htc sense devices and I don't know about Motorola Blur etc.:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/png");
emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_intent_name)));
This code works on the htc sense but not from the Chooser, what I really need:
Intent sendIntent = new Intent("android.intent.action.SEND_MSG");
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
sendIntent.setType("image/png");
context.startActivity(sendIntent);
But I don't know how to combine this code samples together and I don't know how to determine Htc Sense ui programmatically. Is it right way to support different type of devices?
Thank you for answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
感觉,尤其是旧版本是一种痛苦。还有webview控件也有一堆问题。根据消息量,您可以尝试使用诸如亚马逊简单通知服务之类的网络服务来发送短信:http://aws.typepad.com/aws/2011/11/amazon-simple-notification-service-now-supports-sms.html
它不是 Android 解决方案,但它可能有效。
Sense, especially the older versions are a pain. There webview control also has a bunch of problems. Depending on volume of messages you might try using a webservice like amazon's simple notification service to send sms messages: http://aws.typepad.com/aws/2011/11/amazon-simple-notification-service-now-supports-sms.html
Its not an android solution, but it might work.
您可以检测 HTC Intent 是否有响应者,然后分支:
You could detect whether there's a responder for the HTC Intent, and then branch:
你可以这样使用它:
You may use it like this: