开发者

Tracking a SMS sent from an application [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

I am afraid: SMS send from within an app seem impossible to detect?

Sending an SMS from an app in Android is really easy:

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, position, pi, null);

But it seem that all these SMS are "invisible" and the user will never know an SMS has been sent!

-> All SMS applications (Go SMS, Handcent, stock app, etc..) does not show these SMS.

-> These sent SMS does not seem to fire an Intent.

SO, my question is rather simple: how can I track all these SMS and find if an application is malicious?

I don'开发者_JS百科t want to wait till the end of the month to check my bill, it will be too late!


Instead of sending the message like this, you could fire an intent that would get handled by the default SMS application. That would lead to your text showing.

Take a look at this SO post:

send SMS Intent in Android

EDIT:

AFAIK, there is no intent broadcast when Android sends an SMS.


You have to make your own BroadcastReceiver and pass your string into that with the PendingIntent. So it could look something like this...

    private static final String SENT_SMS      = "com.your.stuff.SMS_SENT";
    private static final String DELIVERED_SMS = "com.your.stuff.SMS_DELIVERED";
    private static final String SMS_RECEIVED  = "android.provider.Telephony.SMS_RECEIVED";

The system does however, tell you when the message went out with Activity.RESULT_OK. There are other messages if it is not ok such as SmsManager.RESULT_ERROR_GENERIC_FAILURE so on and so forth. You can check that in the BroadcastReceiver that you set up...

this.sentReceiver = new BroadcastReceiver() {

    @Override
public void onReceive(final Context pContext, final Intent pIntent) {
// Get the result code
switch ( this.getResultCode() ) {
    case Activity.RESULT_OK:
        // Do something that pertains to the SMS going out ok like adding one to your outgoing count
        break;
    case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
        // do something
        break;
    case SmsManager.RESULT_ERROR_NO_SERVICE:
        // do something
        break;

    ...

    default:
        break;
}

};

http://developer.android.com/reference/android/telephony/SmsManager.html


Without any other solutions, the answer seem to be "NO, there is no solutions".

That's a big security issue, in my mind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜