gpt4 book ai didi

android - 以编程方式发送彩信

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:21:46 28 4
gpt4 key购买 nike

我想以编程方式发送彩信,我使用了以下代码

    Intent sendIntent1 = new Intent(Intent.ACTION_SEND); 
try {

sendIntent1.setType("text/x-vcard");
sendIntent1.putExtra("address","0475223091");
sendIntent1.putExtra("sms_body","hello..");
sendIntent1.putExtra(Intent.EXTRA_STREAM,
Uri.parse(vcfFile.toURL().toString()));
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
startActivity(sendIntent1);

问题是它指向撰写消息页面并需要手动发送短信,我不想这样,所以在没有任何通知的情况下它应该发送我该怎么做??

有人请告诉我答案

最佳答案

我终于找到了 100% 有效的解决方案。请引用github项目https://github.com/klinker41/android-smsmms . (任何人觉得它有用请捐赠给作者http://forum.xda-developers.com/showthread.php?t=2222703)。

注意,强制性设置只是

Settings sendSettings = new Settings();

sendSettings.setMmsc(mmsc);
sendSettings.setProxy(proxy);
sendSettings.setPort(port);

你可以得到类似的东西(在 Set APN programmatically on Android 找到 - 由 vincent091 回答):

Cursor cursor = null;
if (Utils.hasICS()){
cursor =SqliteWrapper.query(activity, activity.getContentResolver(),
Uri.withAppendedPath(Carriers.CONTENT_URI, "current"), APN_PROJECTION, null, null, null);
} else {
cursor = activity.getContentResolver().query(Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"),
null, null, null, null);
}

cursor.moveToLast();
String type = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.TYPE));
String mmsc = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.MMSC));
String proxy = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.MMSPROXY));
String port = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.MMSPORT));

关于android - 以编程方式发送彩信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16518393/

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