ACTION_SEND 用于发送短信

2023-11-25

我想打开本机应用程序来发送短信,但应该已经有电话号码。我发现 ACTION_SEND 但当我调用我的函数时,它返回错误:

04-26 11:59:15.991: ERROR/AndroidRuntime(20198): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO (has extras) }

我的代码在这里展示:

    private void smsSend(String number) {
    Intent intent = new Intent(Intent.ACTION_SENDTO, null);
    intent.putExtra(Intent.EXTRA_PHONE_NUMBER, number);
    startActivity(intent);
}

我知道这很简单,但我不知道为什么它不起作用,而且我找不到任何有用的信息。

感谢您的任何建议。


为什么,这应该可以正常工作。http://developer.android.com/reference/android/content/Intent.html#ACTION_SENDTO

查看我的代码:

Uri uri = Uri.parse("smsto:0800000123");   
Intent it = new Intent(Intent.ACTION_SENDTO, uri);   
it.putExtra("sms_body", "The SMS text");   
startActivity(it); 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ACTION_SEND 用于发送短信 的相关文章

随机推荐