0

我正在为安卓开发一个短信应用程序。我想保存消息状态(例如,发送时)

但是接收方在发送 SMS 时总是返回 RESULT_OK。这是我正在使用的代码:

        Main.context.registerReceiver(new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            switch (getResultCode()) {
            case Activity.RESULT_OK:

                Main.log("SMS delivered");
                LogThread logThreadEntregado = new LogThread(main, smsId);
                logThreadEntregado.setEntregado();
                Thread t6 = new Thread(logThreadEntregado);
                // t6.run();
                Main.mHandler.post(t6);
                Main.context.unregisterReceiver(this);
                break;
            case Activity.RESULT_CANCELED:
                Main.log("SMS not delivered");
                LogThread logThreadNoEntregado = new LogThread(main, smsId);
                logThreadNoEntregado.setNoEntregado();
                Thread t7 = new Thread(logThreadNoEntregado);
                Main.mHandler.post(t7);
                Main.context.unregisterReceiver(this);
                // t7.run();
                break;
            }
        }
    }, new IntentFilter(DELIVERED));

我想知道是否有办法(可能使用参数 Context arg0、Intent arg1)来检查消息是否已真正传递。

先感谢您

4

1 回答 1

0

Kannel 将通过您在 SMS 提交中的 dlr-url 参数中指定的 url 向您发送发送报告,例如 example.com/DLR?outgoing_id=123&status=%d。

你用什么语言写的无关紧要。您所需要的只是一个通过 HTTP GET 接受特定参数的 HTTP 页面。Kannel 将为交付状态、时间等添加参数,您将通过上面的 id 将它们链接到您的 SMS 提交。

这个讨论有一个明显的例子。

于 2011-11-02T17:21:30.030 回答