WEB开发网
开发学院手机开发Android 开发 android 验证短信是否发送成功 阅读

android 验证短信是否发送成功

 2012-12-04 20:40:33 来源:WEB开发网   
核心提示::name</span><span>=</span><span class="attribute-value">"android.intent.action.SENT_SMS_ACTION"</span><span
:name</span><span>=</span><span class="attribute-value">"android.intent.action.SENT_SMS_ACTION"</span><span class="tag">/></span><span>         </span></span></li><li class=""><span>  <span class="tag"></</span><span class="tag-name">intent-filter</span><span class="tag">></span><span> </span></span></li><li class="alt"><span><span class="tag"></</span><span class="tag-name">receiver</span><span class="tag">></span><span> </span></span></li></ol></div><pre name="code" class="html" style="display: none; "> <receiver android:name=".AutoSendMessageBroadcastReceiver">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.SENT_SMS_ACTION"/>
</intent-filter>
</receiver>
</pre><br>
<div class="dp-highlighter bg_java"><div class="bar"><div class="tools"><b>[java]</b> <a href="#" class="ViewSource" title="view plain" onclick="dp.sh.Toolbar.Command('ViewSource',this);return false;">view plain</a><a href="#" class="CopyToClipboard" title="copy" onclick="dp.sh.Toolbar.Command('CopyToClipboard',this);return false;">copy</a><a href="#" class="PrintSource" title="print" onclick="dp.sh.Toolbar.Command('PrintSource',this);return false;">print</a><a href="#" class="About" title="?" onclick="dp.sh.Toolbar.Command('About',this);return false;">?</a><div style="position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index: 99; "><embed id="ZeroClipboardMovie_5" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="0" height="0" name="ZeroClipboardMovie_5" align="middle" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&width=0&height=0" wmode="transparent"></div></div></div><ol start="1" class="dp-j"><li class="alt"><span><span class="keyword">public</span><span> </span><span class="keyword">class</span><span> AutoSendMessageBroadcastReceiver </span><span class="keyword">extends</span><span> BroadcastReceiver { </span></span></li><li class=""><span> </span></li><li class="alt"><span>  <span class="annotation">@Override</span><span> </span></span></li><li class=""><span>  <span class="keyword">public</span><span> </span><span class="keyword">void</span><span> onReceive(Context context, Intent intent) { </span></span></li><li class="alt"><span>    <span class="comment">// TODO Auto-generated method stub</span><span> </span></span></li><li class=""><span>    <span class="keyword">switch</span><span> (getResultCode()) {  </span></span></li><li class="alt"><span>     </span></li><li class=""><span>    <span class="keyword">case</span><span> -</span><span class="number">1</span><span>:  </span></span></li><li class="alt"><span>      Toast.makeText(context, <span class="string">"短信发送成功"</span><span>, Toast.LENGTH_SHORT).show();  </span></span></li><li class=""><span>      <span class="keyword">break</span><span>;  </span></span></li><li class="alt"><span>       </span></li><li class=""><span>    <span class="keyword">case</span><span> </span><span class="number">0</span><span>: </span></span></li><li class="alt"><span>      Toast.makeText(context, <span class="string">"发送失败"</span><span>, Toast.LENGTH_LONG).show();  </span></span></li><li class=""><span>      <span class="keyword">break</span><span>; </span></span></li><li class="alt"><span>       </span></li><li class=""><span>    <span class="keyword">default</span><span>:  </span></span></li><li class="alt"><span> </span></li><li class=""><span>      <span class="keyword">break</span><span>;  </span></span></li><li class="alt"><span>    }  </span></li><li class=""><span>  } </span></li><li class="alt"><span> </span></li><li class=""><span>} </span></li></ol></div><pre name="code" class="java" style="display: none; ">public class AutoSendMessageBroadcastReceiver extends BroadcastReceiver {

上一页  1 2 3 4 5  下一页

Tags:android 验证 短信

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接