I'm working on a small application which use data SMS messages.
I know how to manage thé errors during the sending.
I sent several data sms to my contact but I don't know how to know if my data SMS have arrived or not
Can you help me?
When you call SMSManager.sendTextMessage the deliveryIntent parameter tells you whether it was received. This does no mean that the user actually saw it, it just means his network received the text. It may not have been sent to his phone, or it may have been and the user didn't notice the text. There is no way to tell that the user actually looked at it.
Related
I've made a small app from where user can send SMS to many users at the same time. I've done it like it is done i all tutorials and it's working fine. I create a SMSManager, divide a message and send it as a multipart:
ArrayList<String> msgArray=smsManager.divideMessage(msg);
smsManager.sendMultipartTextMessage(phoneNo, null, msgArray, null, null);
Everything works fine. The problem is if user wants to send more than 30 messages in a couple of minutes. In that case Android displays a warning:
"{MyAppName} is sending to many messages. Do you want to allow sending messages?"
For each messages above 30 sent messages, I receive that warning. It gives me an option to allow or to deny. The problem is that even if I click 'allow', messages don't get sent.
Imagine a situation where user chooses 35 contacts and want to send a message to all of them. After he clicks send, 30 messages are sent and for other 5 that dialog is displayed where user is asked does he want to allow further sending.
Even if I click 'allow', message doesn't get sent and only 30 messages are sent. This way user gets an impression that all messages are sent but they are not. Those 5 messages are not sent even if he allowed app to send them.
Is there a workaround for this problem? I need some workaround to find out which messages are not sent and the way to send them.
Thank you.
You shouldn't set null on ArrayList sentIntents argument but add actual array of PendingIntent - you can use that to check if your message was sended correctly. Take a look at documentation.
Probably answer to this question also will be helpful.
i want to goes through some condition statement when a user hit a "send sms" button and thus if condition is satisfied then send the sms otherwise abort the composed sms !
can any one help me ?
No there is not broad cast activity to use it when sms is going to send,
This is not possible. Any application can use SmsManager to send an SMS, and such messages cannot be intercepted, except perhaps by custom firmware.
You can't block an outgoing sms. You can find out about it only after it has been sent. And you can do it by registering a content observer for sms, when the sms comes to sent box.
It is good question, when you are working by using any builten application in android, then it gives you some facility upto some extent, but you can't cross the limit.
If You want to control the send button of builten apps then it is impossible. You can't do this in android.
I am attempting to develop an Android application that sends and receives SMS messages (among other things)
i wish to have my apps SMS messages easily identifiable.
I didnt want to use the SMS message body for this unique identifier, i thought there must be an SMS message attribute i can use. sadly i have failed to find one or track down a technical spec for SMS messages in general.
does anyone know if the SMS message standards have an ID field that can be se programmatically?
No, there is not.
You can see the contents of an standard SMS message on page two of this document, and on this page.
The way I have handled this is by setting an SMS listener with a higher priority than the system SMS listener that looks for a unique string in all received texts.
If the SMS contains the string I handle it in the application and discard the SMS so that I do not litter the users inbox.
The users message alert tone doesn't even go off. It works quite well.
See this post for more info on how to do this:
Can we delete an SMS in Android before it reaches the inbox?
i know it's been 4 years . but in case anyone passes through this question.
yes SMS has unique id called _id and you can identify SMS through it.
for more info please refere to this answer.
I write application which will get data from received SMS. This is data only for application and I dont want to user can read this message. Is possible to consume SMS just after get data from them to prevent user from reading this SMS? Thanks for any help.
You will need a sms receiver see http://davanum.wordpress.com/2007/12/15/android-listen-for-incoming-sms-messages/
Maybe you need also to delete the received sms.
Yes, this is easy to do. See my answer here for how to do this:
SMS receive with no notification
Once you've confirmed that the SMS is one of your special ones, you just need to call abortBroadcast() to stop it going into the user's inbox:
// Stop it being passed to the main Messaging inbox
abortBroadcast();
You should also be aware that the SMS receiver will not intercept SMS messages sent to the user's Google Voice number, as by default those messages will be downloaded over the data connection and displayed by the Google Voice app. If their Google Voice number is configured to forward the SMSs to the phone then those will be handled fine by the SMS receiver.
I want to track the number of messages that are sent from an android phone. I'm aware that there is a Broadcast message whenever a SMS is received but there is no particular event for a sent message.
I don't wanna end up counting the number of messages that appear in the "sent" area cos if I delete a sent message, the count will get changed.
Two possible solutions:
You could read the sent messages folder on a schedule, and only count the messages with time stamps that were sent between the last time you checked and the current time you're checking.
You could send the sms yourself (assuming the user is willing to go through your application to do it), then through your pending intent you could easily tell yourself when this was done.
Personally, I like possible solution #1, thought there is the problem that some SMS applications don't even store the sms in the default content provider: content://sms/sent, or like you said, the user might delete the message too quickly before it can even be counted that first time. Unfortunately, I don't think there is a better solution at this time than an hybrid solution of the two solutions I'm proposing, and even that one offers no guarantee that you won't miss some messages.
You can handle this when you send message.
Store the count in the shared preference.
When SMS is sent, increment the value in the shared preference.