它可能沒有關係,代理可以指「備用」的路線。也許發送彩信不需要替代路由,因此它是空的?
內置的MMS應用程序使用一個名爲TransactionSettings.java的類,該類查詢電話服務內容提供程序,代碼摘錄。
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();
}
這就是說,我使用這種方法,仍然得到空值。
也許你有更好的運氣?
我有問題,甚至得到APNs http://stackoverflow.com/questions/14452808/sending-and-receiving-sms-mms-in-android – toobsco42 2013-03-09 20:44:54