0

I'm developing a business application. When user register in app, app will send his coordinates by using active internet connection. But if connection is not avaliable coordinates will be sended by sms.

Using SmsManager in app to send sms:

    sendSMSButton.Click += (s, e) =>
    {
        var phone = "999999";
        var message = UserLocation;

        var piSent = PendingIntent.GetBroadcast(this, 0, new Intent("SMS_SENT"), 0);
        var piDelivered = PendingIntent.GetBroadcast(this, 0, new Intent("SMS_DELIVERED"), 0);

        _smsManager.SendTextMessage(phone, null, message, piSent, piDelivered);
    };

My problem is that the message that was sent is displayed in user's phone, and he can see coordinates and phone number. So he can edit this data and send again.

How I can prevent showing messages that was sent by smsmanager in outgoing sms of user's phone ?

Mark
  • 27
  • 6

1 Answers1

2

Doesn't seem like you can, sendTextMessageWithoutPersisting has only been added in API 28 and is intended for internal carrier use only. You won't be able to use it since this method requires the Manifest.permission.MODIFY_PHONE_STATE permission. You can read more here in the docs.

Raimo
  • 1,494
  • 1
  • 10
  • 19
  • Do I have other ways to resolve my problem (like deleting message after it has been sent) or mb something else? – Mark Jul 02 '19 at 09:34
  • 1
    @Mark Maybe by using a data message (http://codetheory.in/android-sms/) or you might be able to delete it? https://stackoverflow.com/questions/8614211/deleting-android-sms-programmatically – Raimo Jul 02 '19 at 11:41