Hello Everyone I am unable to use the sendTextMessage Function of the smsManager class successfully. The other emulator is not reporting the message received. No notification comes on it. However i am able to send the Text Messages normally using the built in Messaging App in the Application.
Also i downloaded and tried the SMS tutorials in the mobiforge and other websites, the tutorial program is crashing. // Code is as given below package sms.app; import android.app.Activity; import android.telephony.*; import android.os.Bundle; import android.widget.Toast; import android.content.Intent; import android.app.PendingIntent; import android.content.Context; public class smsapplication extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SmsManager s=SmsManager.getDefault(); Intent intent=new Intent(); int requestCode=0; int flags=0; PendingIntent si=PendingIntent.getActivity(getApplicationContext(), requestCode, intent, flags); try{ s.sendTextMessage("5554", null, "This is my string", si, null); } catch(IllegalArgumentException e) { Toast.makeText(getBaseContext(), "Exception caught", Toast.LENGTH_SHORT).show(); } finally { Toast.makeText(getBaseContext(), "Exception not caught", Toast.LENGTH_SHORT).show(); } final int genfailure=s.RESULT_ERROR_GENERIC_FAILURE; if (genfailure==1) Toast.makeText(getBaseContext(), "GENREIC_FAILURE", Toast.LENGTH_SHORT).show(); final int noservice=s.RESULT_ERROR_NO_SERVICE; if (noservice==4) Toast.makeText(getBaseContext(), "NO SERVICE", Toast.LENGTH_SHORT).show(); final int nullpdu=s.RESULT_ERROR_NULL_PDU; if (nullpdu==3) Toast.makeText(getBaseContext(), "NULL PDU", Toast.LENGTH_SHORT).show(); final int radiooff=s.RESULT_ERROR_RADIO_OFF; if (radiooff==2) Toast.makeText(getBaseContext(), "RADIO OFF", Toast.LENGTH_SHORT).show(); final int iccunsent=s.STATUS_ON_ICC_UNSENT; if (iccunsent==7) Toast.makeText(getBaseContext(), "ICC unsent", Toast.LENGTH_SHORT).show(); final int iccsent=s.STATUS_ON_ICC_SENT; if (iccsent==7) Toast.makeText(getBaseContext(), "ICC sent", Toast.LENGTH_SHORT).show(); } } Also i have given the SMS_SEND permission in the manifest file. I tried the same code in different machine too, it doesnt work. Also most of the tutorials in the net use the deprecated function android.telephony.gsm.SmsManager and not the new one android.telephony.SmsManager. For my project work i have to use a datasms . Can anyone help me with a working sample app in Android 2.0 or 2.1 which uses data message. Further how i am not able to figure out how to register my recipent application to a particular port to which i am sending a data message using another instance of the emulator. I need to solve this issue fast. I am stuck at this place for my project, Any Help would be highly appreciated. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en