通过Android代码发送彩信

发布于 2024-10-18 08:27:43 字数 580 浏览 3 评论 0原文

我正在查看此处发布的代码< /a> 通过 Android 应用程序发送彩信,我已经非常接近了。我已成功发送彩信,但未启用 Wifi 连接。但是当 Wifi 启用时,需要在从不连接中使用 httpConnection 。我读过几篇文章说要使用

ConnectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_MMS,APNBACKENDIP);

And that function returns true 意味着它应该通过 TYPE_MOBILE_MMS 接口路由流量,但它总是超时。有人能指出我正确的方向吗?我还尝试使用 TYPE_MOBILE 而不是 TYPE_MOBILE_MMS 并且该函数返回 false。

I'm looking at the code posted here for sending MMS through an Android Application, and I'm very close. I have successfully sent an MMS while the Wifi connection is NOT enabled. But when it comes time to use the httpConnection in never connections when Wifi is enabled. I've read several posts saying to use

ConnectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_MMS,APNBACKENDIP);

And that function returns true meaning that it should route traffic over the TYPE_MOBILE_MMS interface, but it always times out. Can anyone point me in the right direction? Also I tried using TYPE_MOBILE instead of TYPE_MOBILE_MMS and the function returns false instead.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

念﹏祤嫣 2024-10-25 08:27:43

事实证明这是一个非常简单的答案......在计算 requestRouteToHost 的 IP 地址时,我的 IP 四元组颠倒了。

IE 我有:

int address = ((addr[0] & 0xFF) << 24) | ((addr[1] & 0xFF) << 16) | ((addr[2] & 0xFF) << 8) | (addr[3] & 0xFF);

而它应该是:

int address = ((addr[3] & 0xFF) << 24) | ((addr[2] & 0xFF) << 16) | ((addr[1] & 0xFF) << 8) | (addr[0] & 0xFF);

Turns out it was an incredibly simple answer....I had my IP quad reversed when calculating the IP address for requestRouteToHost.

I.E I had:

int address = ((addr[0] & 0xFF) << 24) | ((addr[1] & 0xFF) << 16) | ((addr[2] & 0xFF) << 8) | (addr[3] & 0xFF);

Whereas it should be:

int address = ((addr[3] & 0xFF) << 24) | ((addr[2] & 0xFF) << 16) | ((addr[1] & 0xFF) << 8) | (addr[0] & 0xFF);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文