sending sms.

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

sending sms.

Postby manju » Wed Jun 25, 2008 9:49 am

hi all...

I have two questions here..

:?: 1) How to send sms from emulator???

:?: 2) How to set speed dial number in emulator?? (as we do in mobile phone)

anybody please reply..
manju
Junior Developer
Junior Developer
 
Posts: 18
Joined: Mon Jun 09, 2008 9:38 am
Location: banglore

Top

Postby jagtap.jj1 » Wed Nov 12, 2008 12:40 pm

Means You want to send sms between two emulator instance.

For this one sample application is there , I am attaching with this post.
Attachments
SMSAPISample.zip
(35.7 KiB) Downloaded 612 times
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Postby polimi » Fri Nov 14, 2008 4:13 pm

Hi jagtap, thanks for your file :) , but I don't understand why the receiver.java gives 2 errors (for the Telephony and intents class). :?
Can you help me please?
Thanks :wink:
polimi
Freshman
Freshman
 
Posts: 5
Joined: Tue Nov 11, 2008 10:17 pm

Postby jagtap.jj1 » Sat Nov 15, 2008 8:17 am

Hi polimi
This is because classes are changed in new sdk , you have to use updated changed classes.

Our goal is to just send sms between two emulator instances , this we can do in eclipse DDMS perspective also.
So even if you delete receiver class and <receiver> tag from manifist file , the application will work fine ;the built in android messaging appl will receive sms(The receiver activity will handled by built in appl ).

Regards
jagtap
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Postby polimi » Sat Nov 15, 2008 12:13 pm

Thanks jagtap :wink:
now ok :D

regards
Polimi
polimi
Freshman
Freshman
 
Posts: 5
Joined: Tue Nov 11, 2008 10:17 pm

Postby goelsvaibhav » Wed Nov 19, 2008 8:05 am

Thanks for sharing SMS sending code....
goelsvaibhav
Junior Developer
Junior Developer
 
Posts: 19
Joined: Fri Oct 17, 2008 7:07 am
Location: Gurgaon, India

Top

Sending SMS on button click not working

Postby diki » Sun Nov 23, 2008 7:22 am

Hi Jagtap,

Firstly, thank you for posting a simple SMS working code. I was easily able to cross-check my code with it. Although everything seems almost the same, sending messages between emulators is not working currently..

In my project, i am trying to send SMS on click of a UI button. The second class (receiver) implements BroadcastReceiver to receive and reply to the sender. To test this, i am starting two emulator instances (5554 & 5556) of the same project from eclipse IDE manually.

Code snippet:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
sendBtn = (Button)findViewById(R.id.btnInvite);
sendBtn.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ Log.i("Click", "SendingReply"); sendInvite(); }});
}

public void sendInvite()
{

String sendData = "Invitation";
SmsManager mng = SmsManager.getDefault();
PendingIntent pi = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
String addr = "5556";

if(addr == null)
{
Log.i("SmsIntent", "Unable to get Address from Sent Message");
}
try{
mng.sendTextMessage(addr, null, sendData, pi, pi);
}catch(Exception e){ Log.e("SmsIntent","SendException", e ); }
}

One observation:

When i launch a second instance of the emulator, the emulator displays the following errors on its UI:

Application Messaging(in process com.android.mms) is not responding
Application Alarm clock is not responding

When i force close them, it shows the UI with the single button (as in the main layout). Could this be a cause of the problem?
Is there any other better way of testing with two emulators? I also tested receiving message from a plain sms receiver which is an instance of some other project. Still no luck..

Kindly let me know..

Thanks in advance.
diki
Freshman
Freshman
 
Posts: 2
Joined: Sun Nov 23, 2008 6:45 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 7 guests