Auto send SMS

Put your problem here if it does not fit any of the other categories.

Auto send SMS

Postby andrex_17 » Thu Nov 27, 2008 5:10 am

Hi guys i'm new here, I need some help, look I want to send a sms to the emulator where I'm running my application, or an alert or a reminder. I thing that isn't imposible, but if you may give some clues I'll be very thanks with yours. Up to now I'm trying:

SmsManager sm = SmsManager.getDefault();
sm.sendTextMessage("5554",null, "My text Message", null, null);

No errors but I don't receive anything I guess that I'll need an Intent receiver or something like that.
andrex_17
Freshman
Freshman
 
Posts: 6
Joined: Wed Nov 26, 2008 8:24 pm

Top

Postby haden » Mon Dec 01, 2008 12:36 pm

If you are using eclipse. You can change your perspective to DDMS perspective and under emulator control you have an option of sending sms.
haden
Experienced Developer
Experienced Developer
 
Posts: 74
Joined: Thu Sep 11, 2008 11:51 am

Postby andrex_17 » Mon Dec 01, 2008 7:19 pm

Yes I'm ussing eclipse, but I wanna do it from an application, It's seems like auto send a reminder, for example, when I pass close to a store I want to receive an alert that I'm passing over there. Somebody thinks that it's possible?
andrex_17
Freshman
Freshman
 
Posts: 6
Joined: Wed Nov 26, 2008 8:24 pm

Postby jmejiaa » Tue Dec 02, 2008 4:54 am

This works for me:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. SmsManager smsManager = SmsManager.getDefault();
  2.  
  3. smsManager.sendTextMessage(to, null, textField.getText().toString(), null, null);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4



"to" is just a 10 digit number. I have no clue however how you would use GPS to send it but it definitely is possible.
jmejiaa
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Nov 15, 2008 6:36 pm

Postby andrex_17 » Tue Dec 02, 2008 6:14 pm

hi guys, trying with this

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  2.  
  3.          Intent contentIntent = new Intent(this,sms.class);
  4.  
  5.          contentIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK);
  6.  
  7.          PendingIntent appIntent =PendingIntent.getActivity(this,0, contentIntent, 0);
  8.  
  9.          Notification notification = new Notification(android.R.drawable.ic_dialog_alert,"Notificacion Andres", System.currentTimeMillis());
  10.  
  11.          notification.setLatestEventInfo(this,  getText(R.string.app_name), getText(R.string.app_name), appIntent);
  12.  
  13.                 mNM.notify(1, notification);
Parsed in 0.033 seconds, using GeSHi 1.0.8.4

now I need put text on the notification, but It works perfectly
andrex_17
Freshman
Freshman
 
Posts: 6
Joined: Wed Nov 26, 2008 8:24 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 19 guests