Android adopts the broadcastreceiver method to automatically obtain the verification code

Two methods for Android to automatically obtain the verification code are broadcastreceiver and contentobserver. Both methods require two steps: registration and deregistration. Remember to add permissions. This article introduces one of them first.

<uses-permission android:name="android.permission.RECEIVE_SMS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_SMS"/>

Method 1: broadcastreceiver custom broadcast

The format is explained as follows: 3GPP and 3GPP2 literacy

3GPP

3GPP is for GSM mobile phones with an extension of. 3gp. The 3rd Generation Partnership Project (3GPP) is a standardization organization established in December 1998. At present, its members include ETSI in Europe, ARIB and TTC in Japan, CCSA in China, TTA in Korea and ATIS in North America. The goal of 3GPP is to develop and implement the global (third generation) mobile phone system specification within the scope of ITU's IMT-2000 plan. It is committed to the evolution from GSM to UMTS (WCDMA). Although the air interface between GSM and WCDMA is very different, its core network adopts GPRS framework, so it still maintains continuity.

3GPP2

3GPP2 is for CDMA mobile phones with an extension of. 3g2. The 3rd generation partnership project 2 (3GPP2) was established in December 1998. Its members include TIA (North America), CCSA (China), ARIB / TTC (Japan) and TTA (South Korea). 3GPP2 is committed to the global development of the (3G) mobile phone system specification in ITU's IMT-2000 plan. In fact, it is a standardization organization of CDMA2000 standard system developed from 2G cdmaOne or IS-95. It is more supported by Qualcomm, which has a number of CDMA key technology patents.

3GPP and 3GPP2 actually have a certain competitive relationship. 3GPP2 is committed to the transition from IS-95 (CDMA standard widely used in North America and South Korea and compatible with Unicom CDMA) to 3G, and has a closer relationship with Qualcomm. The corresponding 3GPP is committed to the transition from GSM to WCDMA (UMTS), so there is some competition between the two institutions.

When broadcast is available, it can be used, calling initSMSBroadcastReceiver () in activity or fragment's onCreate method, and broadcasting this.unregisterReceiver (mSMSBroadcastReceiver) in onDestroy () via / / write off SMS. Unregister

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>