2

I can successfully send an SMS using the following code:

public static void SendSMS(String message, String number) {
    SmsManager sms = SmsManager.getDefault();
    sms.sendTextMessage(number, null, message, null, null);
}

However, the message appears in the conversation between me and the person I send it to. Due to the nature of the game I am creating, each player receives a "secret message". I don't want the person running my app to know others' "secret message" by checking the Messaging app.

Is there any way to prevent this behavior? The only way I can think of is by deleting the most recent message in the conversation, but I'm not sure how to do that either, and there's probably an easier way.

Edit for clarity: For my game, only one person is running the app. I am broadcasting a "secret message" to each player in the game. The person running the app should not know what those messages are, so they should not appear in the user's Messaging app.

Noah
  • 542
  • 1
  • 5
  • 16
  • Looking back at the code in my answer, I see that it looks very much alike yours. So I'm not sure whether it is the fact that I do not pass null as the sent/delivered Intent arguments that makes the difference. What Android version are you testing on? – cYrixmorten Dec 27 '13 at 00:49
  • I'm testing on the lastest version, KitKat, since that is what my device is running. – Noah Dec 27 '13 at 00:59
  • Yeah that is probably the issue then: http://www.droid-life.com/2013/11/26/tip-changing-the-default-sms-app-in-kit-kat-beginners-guide/ – cYrixmorten Dec 27 '13 at 11:29
  • @cYrixmorten I do not think this is the issue. My app is successfully sending the messages through my default Messaging app. I just don't want the message to appear on my side of the conversation. – Noah Jan 02 '14 at 20:19
  • I know. But from what I understand from the quote that I added to my answer, it should not appear as long as your app is sending the message and not selected as the default SMS app. So I believe it is a setting issue on the device. I came to think of whether you have considered the option of using push notification from something like parse.com instead of SMS-based? It is fairly easy to learn and would undoubtedly make the app work as you expect. – cYrixmorten Jan 02 '14 at 20:35

1 Answers1

0

I have written an answer about sending SMS messages here: Send SMS until it is successful

The sender of the message will not see the message anywhere unless it is explicitly displayed by the app that is running the code somwhow. Atleast that is my experience and I have used it for various occasions.

Though I must admit that I am not sure if that is the case for Android 4.4 as I believe they made some changes regarding SMS handling.

From this site: http://thepu.sh/trends/android-kitkat-far-reaching-update-puts-sms-app-developers-notice/

There can only be one default SMS app at any time

If an app is not chosen as the default SMS app, Google wants the developer to disable the option for that app to send a message. If not disabled, any message sent through this non-default app will not be visible in the user’s default SMS app.`

Community
  • 1
  • 1
cYrixmorten
  • 7,110
  • 3
  • 25
  • 33