How to send SMS message on android device in the background?
in my app i need to be able to send a text message in a background, without users intervention. I am using SmsManager (code below) to accomplish that. It does send a message but the popup asking me to choose a delivery method still shows up (even after the message is sent). I do have Google Voice installed thus the popup. Is there a way for me to avoid displaying this popup while sending text message? Perhaps i shall use a different method?
Thanks!
SmsManager sm = SmsManager.getDefault();
sm.sendTextMessage(number, null, message, null, null);
Update: so just to see what will happen i selected a default delivery method being "text message" and check the box saying use this as default. Now when i send the message using the code above it sends it in the background but开发者_如何学JAVA it also bring up the empty form to send a message to :| How do i get rid of this? :)
restored the device and problem was gone, so must've been a third party app causing the send new message form, its all good now, sms is being send in a background. thanks for your help all...
I tested that and didn't have that problem. I have Google Voice installed but only use it for voicemail on my main line so maybe thats it. Can I assume you have a separate Voice number? I think this is just an issue of Android not knowing which number to send the text from so you will have to pick a default the first time. Is there the option to set it as the default method? If your intention is the send this text secretly then maybe you might want to rethink your intentions for doing so.
精彩评论