Efficeint Handling of Multipart SMS or Long SMS in Android - android

I have a few questions on Android SMSManager.
How do I send long SMS, say more than 160 characters. My application send SMS
as an email when there if no wifi/data connection. The SMS as email
is retrieved by the server and the server sent a msg: "Your email has been
recieved". How do I show this message on the alert dialog box.
How do I retrieve long SMS?
Four of my activity is supposed to send sms, so do i need to have multiple BroadcastReciecver for each activity or can i simple handle with one BroadcastReciever? Can i have a snippet code on such?
Currently i part of code handles as all above. But i know my codes are in-efficeint. Thats one reason i have such question.
Please bear my question.

Related

Xamarin.Android: Check SMS Status

In my Xamarin.Android app I send SMS using the following code :
send.Click += (s, e) =>
{
SmsManager.Default.SendTextMessage(number.Text, null, message.Text, null, null);
}
And in another button, I want to check which messages are delivered and which are not, to send undelivered message again.
How can I :
Find messages? Is there an ID (a unique one for each sms) or I should find messages by Number and Text?
Check the status of each message?
Please try the parameters sentIntent and deliveryIntent. Both are PendingIntents that will be broadcasted upon successful sending and delivery to the recipient. Upon building your intent you can add some id from your app that helps you identify which sms was sent/not sent.
To see how to query the SMSProvider, take a look at
this StackOverflow anwer.
The answer above uses Telephony.Sms.Inbox. I suggest trying to access Telephony.Sms.Conversations, which according to the doc contains all sent text-based SMS messages. As the class extends android.provider.Telephony.TextBasedSmsColumns, you should be able to query several error codes and status.

How to get the SMS sender address in Android

I'm new to Android. I'm developing an application and I need to fetch the sender while parsing the message. We will be receiving biz messages like IM-ICICI, fb-623525 etc. I want to know how can I get the SMS address of such alphanumeric character senders.

Send automatic message via android app

I'm just wondering is it possible to send a Message from the app without using actionView or actionSend ( meaning no asking for chooser to send via google or hotmail etc.. ) from the Intent ?
what I want to make is like a TextView and a Button
the user will enter a text in the textview and then click the Button to send the message, then the message will be automiatlly sent to the developer ( me )
I hope what I'm thinking of is possible.
I'm not sure what kind of message you are trying to send, but you can use the SMS feature of the phone to send not only a SMS, but an email, too.
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("1"+yourPhoneNumber, userPhoneNumber, message, null, null);
You can replace phone numbers with emails and it will work without user interaction (unlike sending an email through an email client which cannot be done automatically). You can try it out by texting your own email. For your specific situation, you could set up a developer email that handles all of these messages that you are trying to send. The only issue with this is that you may not know who you are receiving messages from. For example, if you send a SMS -> email, it might show up as from something#vz.com or something. However, you can mitigate this by including addition info in the message payload itself.
Yes, it is possible. You can use the internet connection to have the message saved to some cloud storage or something. Personally, I prefer using Parse.com because they have an amazing API that saves you a lot of hassle.
Just add the message from the EditText to a ParseObject and call the saveEventually() method. As soon as the internet is back on, the message will be sent to your cloud storage.

What SIP header decides that a SIP MESSAGE should be treated as an SMS?

I know that in order to receive SMS Messages via SIP and so the device (phone) treats them using the SMS application, the registration to the SIP server should be done using +g.3gpp.smsip feature tag in the Contact: header.
Register request
REGISTER sip:*** SIP/2.0
...
Contact: <sip:***>;...;+g.3gpp.smsip;...
...
indicating that the device is capable of accepting SMS messages via SIP.
What is required in the MESSAGE request to send a simple text message as a SMS message?
I may be wrong but this is a bit more complex that what you've in mind. Let me try to clarify it:
Adding +g.3gpp.smsip parameter to REGISTER's contact header indicates that you're supporting SMS encapsulation inside SIP MESSAGE request. If this is actually what you want to achieve, to send and SMS your MESSAGE should contain:
Request URI containing your S-CSCF's public service identity (this depends on your operator).
To header also containing your network provider's S-CSCF's PSI.
A Content-Type: application/vnd.3gpp.sms header.
The body of the request should contain SMS RP-DATA (including SMS headers and info).
On the other hand, if what you want to achieve, as you states in our question, is sending a plain text MESSAGE request and receive a SMS, then, you need that your network provider supports SIP gateway to GSM services. If this is what you're looking for, I think that, this will help you.

Is that possible to send a message with Name of sender in android GCM.?

I have developed an android application which can send and receive push messages using Android GCM. Suppose if I am sending a push message to "xyz" device from "aaa" device I am getting a push messages succesfully, but what I need is that parallelly I wanted to display the name of the device which has sent a message with respect to the body of GCM message.
Ex:
xyz:
hi test
Please suggest me on this. Thanks in advance
Regards
Anand
You can send anything in the GCM message. If you want to send the name of the sender alongwith the message, you first need to get the name of the user and save it in a variable. Then add that name with the message in the GCM message. To differentiate the name and message part of the push notification, you can encode the GCM message in a JSON format and then send it to the other user. Then you can decode the message using JSON decoder.

Categories

Resources