Search Results

Search found 11 results on 1 pages for 'smsmanager'.

Page 1/1 | 1 

  • send blank SMS with SmsManager.sendTextMessage method in android

    - by Dany Wehbe
    I created an android app and one of its functions is to send SMS, when I try to send blank SMS it throws an exception. Here is the code: SmsManager sm=SmsManager.getDefault(); sm.sendTextMessage("9999", null, messageBody,sentPI, deliveredPI); messageBody maybe empty string and maybe it is a string, previous method throws IllegalArgumentException when messageBody is empty string! what can I do to send blank SMS?

    Read the article

  • How to save SMS to inbox in android programmatically?

    - by Senthil
    I have written the below code , for sending SMS . SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(destAddr, null, mMessageText, il, null); But this is not updating in my Inbox ,I need to save the same message in Inbox, Or is there any way to invoke a native SMS application to send SMS ?

    Read the article

  • BroadcastReciever doesn't show SMS not Send or Not delivered

    - by user1657111
    While using broadcastreciver for checking sms status, it shows the toast when sms is sent but shows nothing when sms is not sent or delivered (im testing it by putting an abrupt number). the code im using is the one ive seen the most on every site of checking sms delivery status. But my code is only showing the status when sms is sent successfully. Can any one get a hint of what am i doing wrong ? I hav this method in doInBackground() and so obviously im using AsyncTask. Thanks guys public void send_SMS(String list, String msg, AtaskClass task) { String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; SmsManager sms = SmsManager.getDefault(); PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(context, "SMS sent", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(context, "Generic failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(context, "No service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(context, "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(context, "Radio off", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(SENT)); //---when the SMS has been delivered--- registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(context, "SMS delivered", Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(context, "SMS not delivered", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(DELIVERED)); StringTokenizer st = new StringTokenizer(list,","); int count= st.countTokens(); int i =1; count = 1; while(st.hasMoreElements()) { // PendingIntent pi = PendingIntent.getActivity(this,0,new Intent(this, SMS.class),0); String tempMobileNumber = (String)st.nextElement(); //SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(tempMobileNumber, null, msg , sentPI, deliveredPI); Double cCom = ((double)i/count) * 100; int j = cCom.intValue(); task.doProgress(j); i++; count ++; } // class ends }

    Read the article

  • how to recieve text sms to specific port..

    - by Umesh
    recieve text sms to specific port.. I have been looking for an answer to this question but but to no avail. This question has been popped a few times but nobody seems to have a clear answer. my code is as follows.. --MANIFEST FILE-- <receiver android:name=".SMSRecieve" android:enabled="true" <intent-filter <action android:name="android.intent.action.DATA_SMS_RECEIVED"/ <data android:scheme="sms" / <data android:host="localhost" / <data android:port="15005" / </intent-filter </receiver --SMS sending method-- String messageText = msgTxt.getText().toString(); short SMS_PORT = 15005; SmsManager smsManager = SmsManager.getDefault(); smsManager.sendDataMessage("5556", null, SMS_PORT, messageText.getBytes(), null, null); --Broadcast Reciever code-- static final String ACTION = "android.intent.action.DATA_SMS_RECEIVED"; //static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";(tried this too, but failed) if (intent.getAction().equals(SMSNotifyExample.ACTION)) { ...do some work.. } I also tried to replace android:name to "android.provider.Telephony.SMS_RECEIVED" but the result is the same. my application does not recieve the SMS on the specified port. Once i remove the following line its works fine <data android:scheme="sms" / <data android:host="localhost" / <data android:port="15005" / could you suggest me what am i missing??

    Read the article

  • How to kill android application using android code?

    - by Natarajan M
    I am develoing small android application in eclipse. In that project i kill the running process in android, i got the Permission Denial error. how can i solve this problem in android. Anybody help for this problem.... THIS IS MY CODE package com.example.nuts; import java.util.Iterator; import java.util.List; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager.RunningAppProcessInfo; import android.content.Context; import android.content.pm.PackageManager; import android.os.Bundle; import android.telephony.SmsManager; import android.widget.Toast; import android.*; public class killprocess extends Activity { SmsManager smsManager = SmsManager.getDefault(); Recivesms rms=new Recivesms(); String Number=""; int pid=0; String appname=""; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { Number=Recivesms.senderNum; pid=Integer.parseInt(Recivesms.struid); appname=getAppName(pid); Toast.makeText(getBaseContext(),"App Name is "+appname, Toast.LENGTH_LONG).show(); ActivityManager am = (ActivityManager) getSystemService(Activity.ACTIVITY_SERVICE); List<RunningAppProcessInfo> processes = am.getRunningAppProcesses(); if (processes != null){ for (int i=0; i<processes.size(); i++){ RunningAppProcessInfo temp = processes.get(i); String pName = temp.processName; if (pName.equals(appname)) { Toast.makeText(getBaseContext(),"App Name is matched "+appname+" "+pName, Toast.LENGTH_LONG).show(); int pid1 = android.os.Process.getUidForName(pName); //android.os.Process.killProcess(pid1); am.killBackgroundProcesses(pName); Toast.makeText(getBaseContext(), "Killed successfully....", Toast.LENGTH_LONG).show(); } } } smsManager.sendTextMessage(Number, null,"Your process Successfully killed..." , null,null); }catch(Exception e) { Toast.makeText(getBaseContext(),e.getMessage(), Toast.LENGTH_LONG).show(); } } private String getAppName(int Pid) { String processName = ""; ActivityManager am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE); List l = am.getRunningAppProcesses(); Iterator i = l.iterator(); PackageManager pm = this.getPackageManager(); while(i.hasNext()) { ActivityManager.RunningAppProcessInfo info = (ActivityManager.RunningAppProcessInfo)(i.next()); try { if(info.pid == Pid) { CharSequence c = pm.getApplicationLabel(pm.getApplicationInfo(info.processName, PackageManager.GET_META_DATA)); //Log.d("Process", "Id: "+ info.pid +" ProcessName: "+ info.processName +" Label: "+c.toString()); //processName = c.toString(); processName = info.processName; } } catch(Exception e) { //Log.d("Process", "Error>> :"+ e.toString()); } } return processName; } } After executing the code. i got the following error... Permission Denial: killBackgroundProcess() from pid=894, uid=10052 requires android.permission.KILL_BACKGROUND_PROCESSES Also i put the following line on manifest file <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESS" /> Anybody help for how to solve this problem... Thanking you....

    Read the article

  • Unwanted automated creation of new instances of an activity class

    - by Marko
    I have an activity (called Sender) with the most basic UI, only a button that sends a message when clicked. In the onClickListener I only call this method: private void sendSMS(String msg) { PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, Sender.class), 0); PendingIntent pi = PendingIntent.getActivity(this, 0, myIntent, 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage("1477", null, msg, pi, null); } This works ok, the message is sent but every time a message is sent a new instance of Sender is started on top of the other. If I call sendSMS method three times, three new instances are started. I'm quite new to android so I need some help with this, I only want the same Sender to be on all the time

    Read the article

  • Programatically send SMS to email using Verizon Motorola Droid on Android

    - by Dave
    Hi, I was wondering if anyone knew the proper way to send an SMS message to an e-mail address using Verizon's CDMA Motorola Droid phone. The internal messaging application appears to automagically do this. While 3rd party applications like SMSPopup don't seem to be able to properly reply to e-mail addresses unless you compose the message inside the messaging application. When the internal messaging application sends a SMS message there's a corresponding 'RIL_REQUEST_CDMA_SEND_SMS' entry in the logcat (adb logcat -b radio). When you send a SMS to an e-mail address it prints the same thing, so behind the scenes it looks as though it is sending an sms. The interesting thing is that if you look at the content provider sent box the messages are addressed to various 1270XX-XXX-XXXX numbers. On other services you can send e-mail addresses by sending a SMS to a predefined short sms number. And then formatting your SMS as emailaddress subject message i.e. http://en.wikipedia.org/wiki/SMS_gateway#Carrier-Provided_SMS_to_E-Mail_Gateways For example, using T-mobile's number (500) you can send a SMS to an e-mail using the following: SmsManager smsMgr = SmsManager.getDefault(); smsMgr.sendTextMessage("500", null, "[email protected] message sent to an e-mail address from a SMS", null, null); Does anyone know if It is possible to programatically send SMS to email messages from a CDMA Android phone? Does Verizon actually send your replies as SMS messages or are they actually sent as MMS or normal http email messages? Any ideas about how to intercept what the raw message being sent to see what's going on? It might be possible that Verizon somehow generates a fake number temporarily tied to an e-mail address (since repeated messages are not sent to the same number). But, that seems pretty heavy handed. Thanks!

    Read the article

  • Works on emulator but not on device

    - by Klaus
    Hello Community, I have an inner handler class that calls the method sendMessage. sendMessige is outside the handler class, but inside the conatining Android java class. On the emulator (AVD 2.2) it works fine, but on my Android 2.2 device the method sendMessage is not called at all. Inner handler class: private Handler handler2 = new Handler() { public void handleMessage(Message msg) { if (GeoSetting.equals("s") && (inNumber.equals(definedNumber))) **SendService.this.sendMessage(definedNumber, DisplayLoc)**; if (GeoSetting.equals("a")) **SendService.this.sendMessage(inNumber, DisplayLoc)**; stopService(new Intent(getApplicationContext(), GeoService.class)); }; The method that should be called: private void sendMessage(String sendNumber, String sendText){ Toast.makeText(getApplicationContext(), "done!!!", Toast.LENGTH_LONG).show(); SmsManager sms = SmsManager.getDefault(); try { sms.sendTextMessage(sendNumber, null, sendText, null, null); if (Message == true) {Toast.makeText(getApplicationContext(), "Sending SMS to "+sendNumber+": "+sendText, Toast.LENGTH_LONG).show();} } catch (Exception exeption){ Toast.makeText(getApplicationContext(), "Something is wrong, could not send SMS!", Toast.LENGTH_LONG).show(); } Toast.makeText(getApplicationContext(), "method called!", Toast.LENGTH_LONG).show(); } Does anybody have an idea why sendMessage is not called on the real device? Thank you for the help!

    Read the article

  • Sending an SMS in Android

    - by D4N14L
    Hey, I have been making an Android app which needs to send a text message. Here is the current code I have: public class getMessage extends Service { @Override public IBinder onBind(Intent intent) { return null; } @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); client Phone = new client(); String[] msg = Phone.getMsg(user[0],user[1]); PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, getMessage.class), 0); SmsManager man = SmsManager.getDefault(); Log.e("GOT MESSAGE", msg[0]+ " : " +msg[1]); man.sendTextMessage(msg[0], null, msg[1], pi, null); Log.e("Message", "Sent the message?"); } Now, for some reason, the text message will not send using this code, and I'm not sure why. I was hoping that someone here could help me out in finding why this message won't send. No error is raised, nothing appears in the log (except for the log messages that I make myself in the code). Also, the manifest does have the correct tags. Suggestions?

    Read the article

  • Android forwards compatibility

    - by Brian515
    Hi all, I just published my first application to the market, but i just found out that android.telephony.gsm.smsmanager was depreciated as of Android 1.6. My application depends on sending SMS messages, so it cannot not work in 1.6 or newer. I built the project against 1.5, but I only have a device with 1.5 to test on. Since I built on 1.5, am I fine in terms of newer OSes, or will users get force closes? Thanks in advance! P.S. Is there a way to send/receive SMS messages in the emulator? That would be helpful.

    Read the article

1