问题描述
||
我正在尝试使用“如何通过Android中的MMS发送图片”一文以编程方式发送MMS? ....
我试图检索APN值MMSC,MMSProxy和MMSPort,但是我得到的MMSProxy和MMSPort为空值。然后,我通过在\“ Settings-> Wireless&Networks-> MobileNetworks”中检查HTC设备中的这些值。 -> AccesspointNames-> MMS-> \“
但实际上,这里没有为MMSProxy和MMSPort设置任何内容。
但我可以手动发送彩信。
请帮助我如何获取MMSProxy和MMSPort值..或plz告诉我内置MMS应用程序是否将使用任何其他机制发送MMS。
请帮我...
解决方法
没关系,代理可以表示“替代”路由。也许发送MMS不需要替代路由,所以它为空?
内置的MMS应用程序使用名为TransactionSettings.java的类,该类查询Telephony内容提供程序的代码摘录。
public TransactionSettings(Context context,String apnName) {
String selection = (apnName != null) ? APN + \"=\'\" + apnName.trim() + \"\'\" : null;
Cursor cursor = SqliteWrapper.query(context,context.getContentResolver(),Uri.withAppendedPath(Uri.parse(TELEPHONY_CONTENT_URI),\"current\"),APN_PROJECTION,selection,null,null);
if (cursor == null) {
Log.e(TAG,\"Apn is not found in Database!\");
return;
}
boolean sawValidApn = false;
try {
while (cursor.moveToNext() && TextUtils.isEmpty(mServiceCenter)) {
// Read values from APN settings
if (isValidApnType(cursor.getString(COLUMN_TYPE),APN_TYPE_MMS)) {
sawValidApn = true;
mServiceCenter = cursor.getString(COLUMN_MMSC).trim();
mProxyAddress = cursor.getString(COLUMN_MMSPROXY);
if (isProxySet()) {
String portString = cursor.getString(COLUMN_MMSPORT);
try {
mProxyPort = Integer.parseInt(portString);
} catch (NumberFormatException e) {
if (TextUtils.isEmpty(portString)) {
Log.w(TAG,\"mms port not set!\");
} else {
Log.e(TAG,\"Bad port number format: \" + portString,e);
}
}
}
}
}
} finally {
cursor.close();
}
话虽这么说,我使用这种方法,仍然获得空值。
也许您运气更好?