Android4.4不能处理好与&QUOT短信意图; vnd.android-DI​​R / MMS,SMS" [英] Android4.4 can not handle sms intent with "vnd.android-dir/mms-sms"

查看:264
本文介绍了Android4.4不能处理好与&QUOT短信意图; vnd.android-DI​​R / MMS,SMS"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个按钮来启动默认的短信活动, 它的工作完全没有问题的所有Android版本除了新的Andr​​oid 4.4(奇巧) 这里是code:

My application has a button to start default sms activity and it worked perfectly fine all android version except new one, Android 4.4(kitkat) Here is the code:

public void onClick(View arg0) {
    Intent smsIntent = new Intent(Intent.ACTION_VIEW);
    smsIntent.setType("vnd.android-dir/mms-sms");
    smsIntent.putExtra("address", member.getPhoneNumber().trim());
    context.startActivity(smsIntent);
}

和我得到的错误信息

11-08 02:08:32.815: E/AndroidRuntime(14733): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW typ=vnd.android-dir/mms-sms (has extras) }

我知道,谷歌作出的默认短信应用程序如何处理短信的意图一些变化。 但我的应用程序是不是一个短信应用程序,但它只有函数开始与收件人号码默认短信应用程序。所以请大家帮忙。

I know that google made some changes on how the default sms app handles sms intents. but my app is not a sms app but it only has function to start default sms app with recipient number. so please help.

推荐答案

要开始填充号用行动SMS应用程序 ACTION_SENDTO

To start the SMS app with number populated use action ACTION_SENDTO:

Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("smsto:" + Uri.encode(phoneNumber)));
startActivity(intent);

这将工作在Android 4.4系统。它也应该在早期版本的Andr​​oid然而,由于原料药从未公开的行为可能会有所不同。如果没有问题,你的方法之前,我可能会只是坚持到pre-4.4,并使用 ACTION_SENDTO 4.4 +。

This will work on Android 4.4. It should also work on earlier versions of Android however as the APIs were never public the behavior might vary. If you didn't have issues with your prior method I would probably just stick to that pre-4.4 and use ACTION_SENDTO for 4.4+.

这篇关于Android4.4不能处理好与&QUOT短信意图; vnd.android-DI​​R / MMS,SMS"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆