{"id":210538,"date":"2020-11-30T13:28:27","date_gmt":"2020-11-30T05:28:27","guid":{"rendered":"http:\/\/4563.org\/?p=210538"},"modified":"2020-11-30T13:28:27","modified_gmt":"2020-11-30T05:28:27","slug":"%e5%bd%93%e7%9f%ad%e4%bf%a1%e5%88%b0%e8%be%be%e6%97%b6%ef%bc%8c%e5%ae%89%e5%8d%93-app-%e5%8f%af%e4%bb%a5%e8%8e%b7%e5%8f%96%e5%88%b0%e6%8e%a5%e6%94%b6%e5%8f%b7%e7%a0%81%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=210538","title":{"rendered":"\u5f53\u77ed\u4fe1\u5230\u8fbe\u65f6\uff0c\u5b89\u5353 APP \u53ef\u4ee5\u83b7\u53d6\u5230\u63a5\u6536\u53f7\u7801\u5417\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5f53\u77ed\u4fe1\u5230\u8fbe\u65f6\uff0c\u5b89\u5353 APP \u53ef\u4ee5\u83b7\u53d6\u5230\u63a5\u6536\u53f7\u7801\u5417\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : JasonLaw <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5047\u8bbe\u6211\u7684\u5b89\u5353\u624b\u673a\u4e0a\u9762\u6709\u4e24\u4e2a SIM \u5361\uff0c\u6211\u5728\u4e0a\u9762\u5b89\u88c5\u4e00\u4e2a\u6539\u88c5\u8fc7\u540e\u7684 APP\uff0c\u8fd9\u4e2a APP \u53ef\u4ee5\u83b7\u53d6\u5230\u77ed\u4fe1\u7684\u63a5\u6536\u53f7\u7801\u5417\uff1f<\/p>\n<p>\u6211\u770b\u4e86Android: how to get sender and receiver phone number from raw sms &#8211; Stack Overflow\uff0c\u4f46\u662f\u8fd9\u4e2a\u95ee\u9898\u5df2\u7ecf\u5f88\u4e45\u4e86\uff0c\u73b0\u5728\u7684\u8bdd\uff0c\u8fd8\u662f\u6ca1\u6709\u65b9\u6cd5\u5417\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4367575\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wukuai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             APP \u6e90\u7801\u5c31\u61d2\u5f97\u7ffb\u4e86\uff0c\u7528 adb \u4e0d\u9999\u5417\uff0c\u76f4\u63a5\u8bfb\u5e93\uff1a<\/p>\n<p>adb shell su -c content query &#8211;uri content:\/\/sms &#8211;projection _id,address,body,read,date,type,sim_id<\/p>\n<p>\u5176\u4e2d sim_id \u8868\u793a sim \u5361\u7f16\u53f7<\/p>\n<p>example:<\/p>\n<p>Row: 540 _id=1, address=10086, body= [\u516c\u76ca\u77ed\u4fe1] \u5c45\u5b89\u601d\u5371 \u8b66\u949f\u957f\u9e23: XX \u5e02\u4e8e 11 \u6708 14 \u65e5 10\uff1a00 \u81f3 10\uff1a20 \u8fdb\u884c\u9632\u7a7a\u9632\u707e\u8b66\u62a5\u8bd5\u9e23\uff0c\u8bf7\u5e7f\u5927\u5e02\u6c11\u670b\u53cb\u4eec\u5c4a\u65f6\u6ce8\u610f\u8fa8\u542c\u548c\u8bc6\u522b\u9632\u7a7a\u9632\u707e\u8b66\u62a5\u4fe1\u53f7\u3002\uff08\u5e02\u4eba\u9632\u529e\uff09, read=0, date=1605270457272, type=1, sim_id=1                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367576\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : watzds <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b89\u5353\u77ed\u4fe1\u6570\u636e\u5e93\u90fd\u80fd\u8bfb\u5230\uff0c\u4e0d\u8fc7\u73b0\u5728\u7684\u5b89\u5353\u7248\u672c\uff0c\u8981\u5148\u6210\u4e3a\u9ed8\u8ba4\u77ed\u4fe1\u5e94\u7528\u624d\u6709\u6743\u9650\u8bfb\u53d6\uff0c\u4e0d\u8fc7\u8fd9\u6837\u7cfb\u7edf\u539f\u5148\u7684\u77ed\u4fe1\u5e94\u7528\u5c31\u8bfb\u4e0d\u5230\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367577\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qwe7002 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e2a\u6d88\u606f\u5728 PDU \u91cc\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528 getOriginatingAddress()\u65b9\u6cd5\u83b7\u53d6\u3002\u4ece SmsMessage[]\u6570\u7ec4\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u5bf9\u8c61\u90fd\u53ef\u4ee5\u83b7\u5f97\u5230\u5b83                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367578\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JasonLaw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qwe7002 #3 https:\/\/github.com\/cdoyle45\/Simple-SMS-Sender-Receiver\/blob\/8773d144bce3e86251651d10c470bc8c70269381\/app\/src\/main\/java\/casey\/app20\/SMSReceiver.java#L24 \u8fd9\u4e0d\u662f\u83b7\u53d6 sender \u5417\uff1f\u4f46\u662f\u6211\u8981\u7684\u662f receiver \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367579\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : itgoyo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u5982\u679c\u7533\u8bf7\u4e86\u9605\u8bfb\u77ed\u4fe1\u7684\u6743\u9650\uff0c\u7136\u540e\u6709\u65b9\u6cd5\u53ef\u4ee5\u8bfb\u53d6\u5230\uff0c\u4f46\u662f\u6709\u95ee\u9898\u5c31\u662f\u73b0\u5728\u624b\u673a\u5728\u77ed\u4fe1\u5217\u8868\u7684\u8bbe\u7f6e\u91cc\u9762\u628a\u5141\u8bb8\u7b2c\u4e09\u653e\u8bfb\u53d6\u77ed\u4fe1\u7684\u8bbe\u7f6e\u7ed9\u5173\u4e86\uff0c\u6240\u4ee5\u6709\u8fd9\u4e24\u4e2a\u6b65\u9aa4\u3002\u56e0\u4e3a\u6700\u8fd1\u5728\u505a\u4e00\u4e2a\u8bfb\u53d6\u77ed\u4fe1\u7136\u540e\u81ea\u52a8\u586b\u5145\u7684\u529f\u80fd\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367580\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JasonLaw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wukuai #1 \u8fd9\u4e2a\u80fd\u5728 APP \u8fd0\u884c\u65f6\u4f7f\u7528\u5417\uff1f\u6211\u4e0d\u662f\u592a\u61c2 Android \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367581\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JasonLaw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @itgoyo #5 \u201c\u4f60\u5982\u679c\u7533\u8bf7\u4e86\u9605\u8bfb\u77ed\u4fe1\u7684\u6743\u9650\uff0c\u7136\u540e\u6709\u65b9\u6cd5\u53ef\u4ee5\u8bfb\u53d6\u5230\u201d\u3002\u8bf7\u95ee\u662f\u600e\u6837\u7684\u65b9\u6cd5\u5462\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367582\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : itgoyo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             &#8220;`<br \/>public class PhoneCode extends ContentObserver {<\/p>\n<p> private Context mContext;<br \/> private String code;<br \/> private SmsListener mListener;<br \/> private Cursor mCursor;<br \/> private int index = 0;<\/p>\n<p> public PhoneCode(Context context, Handler handler, SmsListener listener) {<br \/> super(handler);<br \/> this.mContext = context;<br \/> this.mListener = listener;<br \/> }<\/p>\n<p> @Override<br \/> public void onChange(boolean selfChange) {<br \/> super.onChange(selfChange);<br \/> Log.d(&#8220;\u9a8c\u8bc1\u7801&#8221;, &#8220;onChange&#8221;);<br \/> index++;<br \/> mCursor = mContext.getContentResolver().query(Uri.parse(&#8220;content:\/\/sms\/&#8221;), new String[]{&#8220;_id&#8221;, &#8220;address&#8221;, &#8220;read&#8221;, &#8220;body&#8221;, &#8220;date&#8221;}, null,<br \/> null, &#8220;date desc&#8221;);<br \/> if (mCursor == null) {<br \/> return;<br \/> }<br \/> while (mCursor.moveToNext()) {<br \/> String address = mCursor.getString(mCursor.getColumnIndex(&#8220;address&#8221;));<br \/> String body = mCursor.getString(mCursor.getColumnIndex(&#8220;body&#8221;));<br \/> if (!address.endsWith(&#8220;268082&#8221;)) {<br \/> return;<br \/> }<br \/> String regEx = &#8220;(?&lt;![0-9])([0-9]{&#8221; + 4 + &#8220;})(?![0-9])&#8221;;<br \/> Pattern pattern = Pattern.compile(regEx);<br \/> Matcher matcher = pattern.matcher(body);<br \/> if (matcher.find()) {<br \/> code = matcher.group();<br \/> if (mListener != null) {<br \/> mListener.onResult(code, index);<br \/> }<br \/> }<br \/> }<\/p>\n<p> if (mCursor != null) {<br \/> mCursor.close();<br \/> }<br \/> }<\/p>\n<p> public interface SmsListener {<\/p>\n<p> void onResult(String result, int index);<br \/> }<br \/>}<br \/>&#8220;`                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367583\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : JasonLaw <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @itgoyo #8 \u4f60\u662f\u8bf4 address \u5417\uff1f address \u662f sender \u7684\u53f7\u7801\u8fd8\u662f receiver \u7684\u53f7\u7801\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4367584\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : itgoyo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             sender \u7684\u53d1\u9001\u7aef\u7684\u53f7\u7801\uff0c\u5927\u591a\u6570\u90fd\u662f 10690 \u5f00\u5934\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u77ed\u4fe1\u5230\u8fbe\u65f6\uff0c\u5b89\u5353 APP \u53ef\u4ee5\u83b7&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/210538"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210538"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/210538\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210538"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}