broadcastreceiver - SMS_Sending Blackberry 10 Android runtime? -
i tried repackage android app blackberry 10. worked pretty well, app unable send sms.
my android code:
private void sendsms(string phonenumber, string message) { string sent = "sms_sent"; string delivered = "sms_delivered"; pendingintent sentpi = pendingintent.getbroadcast(getbasecontext(), 0, new intent(sent), 0); pendingintent deliveredpi = pendingintent.getbroadcast(getbasecontext(), 0, new intent(delivered), 0); //---when sms has been sent--- registerreceiver(new broadcastreceiver() { @override public void onreceive(context arg0, intent arg1) { switch (getresultcode()) { case activity.result_ok: toast.maketext(getbasecontext(), "sms sent", toast.length_short).show(); break; case smsmanager.result_error_generic_failure: toast.maketext(getbasecontext(), "generic failure", toast.length_short).show(); break; case smsmanager.result_error_no_service: toast.maketext(getbasecontext(), "no service", toast.length_short).show(); break; case smsmanager.result_error_null_pdu: toast.maketext(getbasecontext() , "null pdu", toast.length_short).show(); break; case smsmanager.result_error_radio_off: toast.maketext(getbasecontext() , "radio off", toast.length_short).show(); break; } } }, new intentfilter(sent)); //---when 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)); smsmanager sms = smsmanager.getdefault(); sms.sendtextmessage(phonenumber, null, message, sentpi, deliveredpi); }
manifest :
<uses-permission android:name="android.permission.send_sms"> </uses-permission> <uses-permission android:name="android.permission.receive_sms"/> <uses-permission android:name="android.permission.read_sms"/>
this code working in android , able send message. not working in black berry. please 1 me. thank in advance.
error_radio_off
that means radio off... if off how supposed send message? radio needed communicate network , dispatch message. implies sim needed in order send respective message
if radio off
you should figure out if device activated.. if not cannot send message, activated means associated carrier network , allowed dispatch messages.
Comments
Post a Comment