) {
Unregisterreceiver (Connectionreceiver);
}
Ps: There are a lot of ways to use Telephonymanager on the Internet, as follows (but I have tried several times to have problems, such as the first time you enter an activity will automatically receive the signal of network disconnect, each time the network state changes to receive multiple callbacks and the state is not correct.) Do not know what to pay attention to the place, seek advice! )
Copy
via code telephonymanager TM = (Telephonymanager) This.getsystemservice (Telephony_service);
String imei= Tm.getdeviceid (), obtained, 360 first hooks the method of Telephonymanager class Getdeviceid (), if the user rejects,360 returns the result of Getdeviceid () is "00000000000000" so invalid IMEIAs shown in figureIf allowed, return the true IMEI, as shown
Want to implement the telephone listener, thinking:1. The program must be run in the background first, so it needs to be serviced.2. How to implement telephone monitoring, first to obtain the phone manager, and then monitor the status of the phone.3. Through the different status of the phone, to achieve telephone monitoring.4. You have to start the boot.5. Do a daemon and you can't shut down.6. In the main activity of the OnCreate () automatically open, this activity does not need the pageLook a
Android determines the operator of the mobile phone number
TextView TV = (TextView) findViewById (R. id. TV); TelephonyManager telManager = (TelephonyManager) getSystemService (Context. TELEPHONY_SERVICE); // get the IMSI code of the SIM card String imsi = telManager. getSubscriberId (); // MNC if (imsi! = Null) {if (imsi. startsWith ("46000") | imsi. startsWith ("46002") {// because IMSI under mobile netwo
TextView tv= (TextView) Findviewbyid (r.id.tv); Telephonymanager Telmanager = (telephonymanager) getsystemservice (context.telephony_service); Get the IMSI code of the SIM card String IMSI = Telmanager.getsubscriberid (); MNC if (imsi!=null) {if (Imsi.startswith ("46000") in half-segment IMIS | | imsi.startswith ("46002")) {// Because the mobile network number 46000
In Android development platform, you can get the native number via Telephonymanager. 1 telephonymanager phonemgr= (telephonymanager)this. Getsystemservice (Context.telephony_ SERVICE); 2 // txtPhoneNumber is a edittext used to display the phone numberNote:Depending on the security mechanism of Android, when using Telephonym
and Aidl files required by the application environment.(1) Create a package in the app: Android.telephony\framework\telephony\java\android\ the Android system under the frame The Neighboringcellinfo.aidl file in the telephony directory is copied to the package created above (android.telephony);(2) Create a package in the app: Com.android.internal.telephony\framework\telephony\java\com\android\internal\ the Android system under the frame The Itelephony.aidl file in the telephony directory is cop
The IMEI: International Mobile Equipment Identification Number (IMEI) identifies mobile devices. It is stored in mobile devices and can be used to monitor stolen or invalid mobile devices. IMEI can be found by typing "* #06 #" on mobile devices of different manufacturers. (different manufacturers may have different input content on their mobile phones ). The total length is 15 digits, and each digit only uses 0 ~ 9 ).
The method to obtain IMEI is as follows: 1) Use
Sdcard and SIM card are used in a project. When using sdcard, You need to determine whether the status can be read and written. When using a SIM card, you must determine whether it is readable. For how to do this, see the following two functions:// Whether sdcard can be read/writtenPublic Boolean iscanusesdcard (){Try {Return environment. getexternalstoragestate (). Equals (Environment. media_mounted );} Catch (exception e ){E. printstacktrace ();}Return false;}// Whether the SIM card is readabl
:
It is to enable a service and monitor whether the phone is hung up. If the phone is hung up, immediately resend the call.
The implementation is as follows:
Import Android. App. Service;
Import Android. content. intent;
Import android.net. Uri;
Import Android. OS. ibinder;
Import Android. telephony. phonestatelistener;
Import Android. telephony. telephonymanager;
Public class loopcallservice extends Service {
Public static string phonenumber = "95
In the android development platform, you can use telephonymanager to obtain local information.
Telephonymanager phonemgr = (telephonymanager) This. getsystemservice (context. telephony_service );Txtphonemodel. settext (build. model); // Mobile Phone ModelTxtphonenumber. settext (phonemgr. getline1number (); // local phone numberTxtsdkversion. settext (build. ver
Android gets the mobile phone IMSI number
1. What is imsi?
The IMSI (International Mobile SubscriberIdentification Number) identifies different Mobile users. It is stored in SIM cards and can be used to distinguish valid information of Mobile users. The total length is no more than 15 characters, and 0 ~ 9. Among them, MCC is the country code of the mobile user, which accounts for three digits. China's MCC stipulates that it is 460. MNC is a mobile network number, which consists of up to two dig
Tools related to android Networks
Tools related to android Networks
Stick it to the past and use it.
Package com. activity;Import java. util. List;Import android. content. Context;Import android. location. LocationManager;Import android.net. ConnectivityManager;Import android.net. NetworkInfo;Import android. telephony. TelephonyManager;/*** Network-related tools*/Public class NetUtils {/*** Whether the Network is available** @ Param activity*
Mobile phone information (mobile phone number, SMS, contact, call record, location) can be obtained through the file sharer of the system program. How to obtain the mobile phone number this time.
First, register permissions in AndroidMainfest:
The second step is to define and initialize TelephonyManager, which is located in the package android. telephony. TelephonyManager.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.