编程方式发送SMS(没有得到交​​货状态) [英] Programatically send SMS (Not getting delivery status)

查看:187
本文介绍了编程方式发送SMS(没有得到交​​货状态)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/12701254/programatically-send-sms-android-not-receiving-status\">Programatically发送短信的Andr​​oid(不接收状态)

我使用这个code例如的逐字逐句除事实上,我改变了

I am using this code example word for word except for the fact that I changed

   import android.telephony.gsm.SmsManager;

   import android.telephony.SmsManager;

该短信​​发送精细然而,我没有得到它被传递的消息TOAST(发送到网络)。我试图SMS融入我的应用程序,这是非常重要的。我相信这是可以做到,因为要不然怎么会股票的短信应用知道何时停止显示发送圈。有关code部分如下:

The SMS is sending fine however I am not getting the TOAST message that it was delivered (sent to the network). I am trying to integrate SMS into my application and this is important. I am sure this can be done because how else would the stock SMS app know when to stop displaying the "sending circle". The relevant code section is as follows:

    //---when the SMS has been delivered---
    registerReceiver(new BroadcastReceiver(){
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            switch (getResultCode())
            {
                case Activity.RESULT_OK:
                    Toast.makeText(getBaseContext(), "SMS delivered", 
                            Toast.LENGTH_SHORT).show();
                    break;
                case Activity.RESULT_CANCELED:
                    Toast.makeText(getBaseContext(), "SMS not delivered", 
                            Toast.LENGTH_SHORT).show();
                    break;                        
            }
        }
    }, new IntentFilter(DELIVERED));        

我使用的是果冻豆ROM,但我相信我刚才测试了这个相同的网段上姜饼和ICS具有相同的结果。有API改变或有与样品的问题吗?我在Sasmsung GSIII测试是否有帮助。我的老测试是在一个史诗。

I am using a Jelly Bean ROM but I believe I tested this same segment a while ago on Gingerbread and ICS with the same results. Has the API changed or is there an issue with the sample? I am testing on a Sasmsung GSIII if that helps. My old tests were on an Epic.

推荐答案

使用吐司测试可以迷惑的事情,因为这取决于Toast通知可能不会引发这种情况。请尝试更改到日志呼叫或使用调试器,看看是否能部分被调用的。

Using a Toast to test can confuse things since depending on the situation the Toast notification may not be raised. Try changing it to a Log call or use a debugger to see if that part gets called at all.

这篇关于编程方式发送SMS(没有得到交​​货状态)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆