问题描述
我想发彩信编程我用下面的code吧
I want to send an MMS programmatically I used the following code for it
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);
问题是,它引导到撰写邮件页面,需要手动发送短信,我不想因此没有任何通知应发送我该怎么办呢?
The problem is it directing to the compose message page and requires manually send the SMS and i dont want so without any notification it should send How can i do it??
有人请分享我的答案
推荐答案
我终于找到了一个解决方案,工程100%。请参考GitHub的项目 https://github.com/klinker41/android-smsmms 。 (任何人谁发现它有用,请捐赠给作者<一个href="http://forum.xda-developers.com/showthread.php?t=2222703">http://forum.xda-developers.com/showthread.php?t=2222703).
I finally found a solution that works 100%. Please refer to github project https://github.com/klinker41/android-smsmms. (Anyone who find it usefull please donate to author http://forum.xda-developers.com/showthread.php?t=2222703).
请注意,该强制设置仅
Settings sendSettings = new Settings();
sendSettings.setMmsc(mmsc);
sendSettings.setProxy(proxy);
sendSettings.setPort(port);
你可以让他们像(在在安卓编程设置APN - 通过vincent091 answear):
you can get them something like (found at Set APN programmatically in android - answear by 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));
这篇关于发送彩信编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!