简体   繁体   中英

Send SMS without the SMS appearing in the Messaging app?

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.

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.`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM