首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >发送彩信时MMS代理和MMS端口中的空值问题

发送彩信时MMS代理和MMS端口中的空值问题
EN

Stack Overflow用户
提问于 2011-06-13 15:20:35
回答 1查看 1.4K关注 0票数 0

我正在尝试使用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的值。或者请告诉我内置的彩信应用程序是否会使用任何其他机制来发送彩信。??

请在这方面帮助我……

EN

回答 1

Stack Overflow用户

发布于 2011-08-17 04:38:38

这可能无关紧要,代理可能意味着“替代”路由。也许发送彩信不需要备用路由,所以它是空的?

内置彩信应用程序使用一个名为TransactionSettings.java的类,该类查询电话内容提供商,代码摘录。

代码语言:javascript
复制
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();
    }

也就是说,我使用这个方法,仍然得到空值。

也许你有更好的运气?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6327615

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档