blu*_*ion 14 java sms android android-intent android-4.4-kitkat
我的应用程序有一个按钮来启动默认短信活动,它工作得很好所有Android版本,除了新的,Android 4.4(kitkat)这是代码:
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);
}
Run Code Online (Sandbox Code Playgroud)
我收到错误消息
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) }
Run Code Online (Sandbox Code Playgroud)
我知道谷歌对默认的短信应用如何处理短信意图做了一些改变.但我的应用程序不是短信应用程序,但它只具有启动默认短信应用程序与收件人号码的功能.所以请帮忙.
Ada*_*amK 28
要使用数字填充的使用操作启动SMS应用程序ACTION_SENDTO:
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("smsto:" + Uri.encode(phoneNumber)));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
这适用于Android 4.4.它也适用于早期版本的Android,但由于API从未公开,因此行为可能会有所不同.如果您对先前的方法没有问题,我可能会坚持使用4.4之前的版本并使用ACTION_SENDTO4.4+.
| 归档时间: |
|
| 查看次数: |
12975 次 |
| 最近记录: |