我正在尝试使用post How to send image via MMS in Android?编程发送彩信...
我正在尝试检索APN值MMSC、MMSProxy和MMSPort,但MMSProxy和MMSPort的值为空值。然后,我通过导航"Settings-->Wireless&Networks-->MobileNetworks-->AccessPointNames-->MMS-->“在我的HTC设备中检查了这些值,但这里实际上没有为MMSProxy和MMSPort设置任何内容。但是我可以手动发送彩信。
请告诉我如何获取MMSProxy和MMSPort的值。或者请告诉我内置的彩信应用程序是否会使用任何其他机制来发送彩信。??
请在这方面帮助我……
发布于 2011-08-17 04:38:38
这可能无关紧要,代理可能意味着“替代”路由。也许发送彩信不需要备用路由,所以它是空的?
内置彩信应用程序使用一个名为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();
}也就是说,我使用这个方法,仍然得到空值。
也许你有更好的运气?
https://stackoverflow.com/questions/6327615
复制相似问题