Can anyone tell me what the difference is between 'data sms' and 'text sms'? I think I know pretty well what a 'text sms' is, but what is a 'data sms'?
This question arose while developing an android app that receives incoming sms. Using the android api, one can choose whether the incoming sms is 'data' (android.intent.action.DATA_SMS_RECEIVED) or 'text' (android.provider.Telephony.SMS_RECEIVED).
And, is this differentiation only in android api or is it rather general?
Thank you.
no, "Data SMS" is not "SMS over a 3G/4G data connection". Data SMS is just a kind of SMS message where the message is not encoded as a text string but binary.
Data SMS messages are sent through the data network, over your 2G / 3G data connection, just like all other data such as internet traffic. Normally SMS messages have their own method of transport.
Related
I have seen many questions asking how to get the SMS sender's phone number, but not the recipient's phone number. I have used the tool on this site to generate a PDU and can see the recipient's phone number in it:
Useful PDU details and PDU translation tool
However, I don't see anywhere in the SmsMessage class provided by Android where I can get the recipient's phone number. The reason I want to do this is that I have a Dual SIM phone, but don't see anywhere in Android where I can determine what SIM port is being used for the incoming SMS. At the very least, I want to look at each SMS message and determine what phone number they were sent to.
This question seems very similar to mine but with no answers:
How to get SMS recipient's phone number in Android
My question is different because I have detailed a link to a site about PDUs, which may be useful for extracting the phone number form the raw PDU bytes that the SmsMessage class provides.
Any ideas?
It depends from which point you watch SMS message.
SMS PDU lies on top of MAP protocol.
When you send SMS message, phone puts recipient number in TP-Destination within a PDU, when you receive SMS message, there is no recipient number anywhere. The reason for this is how SMS works.
When someone sends you SMS, GSM network on his side request SRIsm message for you, that means his HLR will try to find you either in his home network, or through your home HLR. The response from HLR is IMSI number (your SIMcard) and VLR/MSC number, to where sender network must send SMS.
In second packet, which is actually SMS message (Forward-MT), therefore is only your IMSI number.
Since you have dual SIM, you can try to find based on this number, to which SIM card is SMS destined.
Note that IMSI number is not part of the PDU but rather lower MAP protocol.
I've implemented code to send sms message from an Android emulator to another, which works well. But when I try to send message from the emulator or an Android device(with wifi only, no data plan or number with the phone) to a device(iPhone ), it doesn't work. I'm not quite sure if sms needs a data plan to send message in real world. Thx for the help!
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(number, null, message, null, null);
Though sms does not require a data plan, it needs a working GSM or CDMA Network connection with call working.
SMS is Short Message Service. It's been around longer than we've had internet on phones, and definitely requires a valid SIM card and a working network connection (data over network isn't necessary, but you should be able to make calls).
I'm sending SMS in my Android App,
SmsManager sm = SmsManager.getDefault();
String number = "1234567890";
sm.sendTextMessage(number, null, "Test SMS Message--Successful", null, null);
It is working fine. My Question is, Is it possible to add string/text instead of Sender Mobile Number? so that in the recipient mobile, the sender's mobile number will be appeared as that string/text.
Yes, it is possible to change the sender phone number, but you need to use a third party SMS Gateway. You can reroute the SMS to come from a phone number that you register for your app.
Twilio - http://www.twilio.com/help/faq/sms/can-i-specify-the-phone-number-a-recipient-sees-when-getting-an-sms-from-my-twilio-app
TextMagic - http://www.textmagic.com/app/pages/en/products/bulk-sms-gateway-api
No. It is not possible. Here are multiple reasons why:
When you send an sms, using SmsManager you encode it with the content - the actual text message itself. You also encode it with the phone number you are sending it to. And you encode the message center number to the message. That is all you get to encode. Then Android/hardware handles sending it over to the cell phone tower where it is then out of your hands.
If you somehow tried to encode the recipient phone number as text, then the carrier would have no idea how to handle the message. It wouldn't have anywhere to send it too.
Cell phones do not have inbound Caller (or sms) ID - unless the number is already programmed, of course.
When the carrier network is sending an sms, it goes through a message center. The message center determines what data is forwarded to the recipient phone. The message centers currently available just do not support what you're wanting - at least not to the consumer.
Basically I want to create an application on Android device which able to send a message to my third-party server without being connected to internet through wi-fi or 3G service.
Is there anyway to achieve this?
Sure, if by 'message' you mean text message/SMS or phone call. You could setup a server to send and respond to SMS messages, but that's not exactly trivial.
Some years ago I played around with remotely setting a TV recording on my PC-based PVR using SMS.
My phone provider had an SMS to email gateway service that allowed me to send an SMS message in the format someone#somewhere.com subject message.
My email provider allowed me multiple POP3 addresses so I set one up for pvr#mydomain.com and I could send a message to it using 'Do record' as subject and a message body of something like...
4 20100109 1900 2000
...which meant record channel 4 from 7pm to 8pm on the 9th Jan 2010.
I wrote some code on my server to check the POP3 account for pvr#mydomain.com every 5 minutes and check for any messages with the subject 'Do record'. If it found any, it downloaded the full message and processed the body.
Google for RFC 1939 which explains the POP3 protocol.
I've got an app that lets users send sms messages. Works great when the message < 160 characters. After that, things work less-perfectly. Seems like there are a few options here:
Manually break the message up into multiple SMSs, send each part as a separate SMS.
Use the multi-part send SMS function (sendMultipartTextMessage()).
Send the message as an MMS message (sendDataMessage()?).
Here's my novice take on it:
1)
most well supported across carriers. Users may get mad that you just cost them N separate messages though, instead of converting to MMS or something.
2)
not sure if this is supported by different carriers, and read that once the message is greater than 3 * 160 chars in length, gets converted to MMS anyway by different SMS apps - maybe stay away from this altogether.
3)
not sure how to do this, and older phones might not support MMS. To send an MMS using the android SDK, do we just use the SmsManager.sendDataMessage() method?
Thanks
This is quite an old post but it's high up on Google when searching for Android multipart sms, so maybe it helps someone.
Regarding part 1 and 2, it's pretty much the same thing. To use sendMultipartTextMessage, you need to break up the long message into an ArrayList of Strings. It then sends as many SMS as needed. In short:
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(longMessage);
sms.sendMultipartTextMessage(phoneNumber, null, parts, null, null);
Part 3: MMS is not an option, as it has been pointed out. The charges and all.
seems to me that the first option is what most mobile phones do by default. sms messages by design can only send a certain amount of characters (160 probbaly), just inform the user that the message is too big and if he still wants to send it anyway (informing also how many sms would the total be).
as for MMS and multipart as you said not every carrier supports it, so they dont seem to be the best option.
EDIT: as for how does MMS work on android-sdk check this thread out: Android SDK MMS
I would suggest the usage of option 2 when you are working on Androids GSM based handsets.
GSM based Mobile device takes care of segmentation in which breaking the messages to multiparts for sending in performed and also assembling of the multipart messages in to one message on receipt.
If you have a method which takes care of sending text messages, than by default use the options of manager.divideMessage as it will work even if the message segments required are only 1 in number.
I dont think you should have any problem sending messages using option 2 and it will also ensure that the receiver receives the message as a single message.
Else we need to write your our own protocol stack where in you write reference number and number of messages for the receipient to understand and recreate the complete message; which is not very tough. We can use byte arrays with headers and the messages can be sent as base64 encoded.
Also I dont know much about the limits the carriers enforce on the number of segments in multipart message; based on my test I was able to send and receive 160*8 segments properly. Based on the GSM standards the segments can be upto 255 but that count might depend on the service provider implementation.