安卓:有没有办法听传出的短信? [英] Android: Is there any way to listen outgoing sms?
本文介绍了安卓:有没有办法听传出的短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道呼入短信可以容易地使用广播reciever截获。但我没有看到任何方式来拦截传出的短信。如何才能做到这一点?但是有一个办法做到这一点。因为很多第三方应用程序读取传入和传出的短信。
I know that an incoming sms can be easily intercepted using a broadcast reciever. But I did not see any way to intercept an outgoing sms. How can this be done? But there is a way to do this.. Because many third party applications read both incoming and outgoing sms.
推荐答案
您将不得不做这样的事情:
You will have to do something like this:
- 缓存所有消息的散$ C $手机基于C
- 注册的内容观察员了解内容://短信
- 在的onChange 方式观测,enumrate所有消息以检查它是否在缓存中,如果不是,该消息被发送出去刚才。
- Cache all messages's hash code on the phone
- Register an content observer for content://sms
- In onChange method of observer, enumrate all messages to check if it is in cache, if not, the message is sent out just now.
祝你好运与您的项目: - )
Good luck with your project :-)
编辑:MD5法
可以采取(抵达日期+消息)文本,以获得一个唯一的MD5输出。
md5 method
You can take the (arrival date + message) text to get a unique md5 output.
private String md5(String in) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
digest.reset();
digest.update(in.getBytes());
byte[] a = digest.digest();
int len = a.length;
StringBuilder sb = new StringBuilder(len << 1);
for (int i = 0; i < len; i++) {
sb.append(Character.forDigit((a[i] & 0xf0) >> 4, 16));
sb.append(Character.forDigit(a[i] & 0x0f, 16));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) { e.printStackTrace(); }
return null;
}
这篇关于安卓:有没有办法听传出的短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文