gpt4 book ai didi

android - Android 中的彩信无法使用 Intent.ACTION_SEND

转载 作者:行者123 更新时间:2023-11-29 22:27:29 27 4
gpt4 key购买 nike

我如何在 android 中发送彩信?

我使用 UI 的代码如下:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("address", "5556");
intent.putExtra("sms_body", "Gudmng !!");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(new File("/sdcard/sky.png"));
intent.putExtra(Intent.EXTRA_STREAM, uri); // imageUri set
intent.setType("image/*")
startActivity(intent);

但是发送彩信还是异常(exception)

ERROR/HierarchicalStateMachine(68): TetherMaster - unhandledMessage: msg.what=3

有什么帮助吗?

最佳答案

我不确定你的代码有什么问题,但我已经使用了它并且它有效:

Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpg");
sendIntent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");
sendIntent.putExtra("sms_body", "hello");
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivityForResult(sendIntent, 0);

也许您可以合并它并根据您的需要进行更改。

关于android - Android 中的彩信无法使用 Intent.ACTION_SEND,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5417261/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com