canceledThe system will pop up a dialog to remind you of the harm of revocation, if the user is determined to revoke, will bring the following reaction
If your program is running, it will be killed.
Crashes may occur when your app is running again
Why it could crash, like the code belowTelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);String
[] Getsystemlanguagelist () {
return Locale.getavailablelocales ();
}
/**
* Get the current phone system version number
*
* @return System version number
*/
public static String getsystemversion () {
return Android.os.Build.VERSION.RELEASE;
}
/**
* Get phone model
*
* @return Phone model
*/
public static String Getsystemmodel () {
return Android.os.Build.MODEL;
}
/**
* Access to mobile phone manufacturers
*
* @return Handset Maker
*/
There are a number of scenarios and requirements that you need to use a unique identifier for your mobile device.In Android, there are several ways to get such an ID.1. The IMEI: only valid for Android phones:
12
(telephonymanager)getsystemservice(telephony_servicetelephonymgr. Getdeviceid
With this approach, you need to include a license in Androidmanifest.xml: Android.permission.READ_PHONE_STATE, and the use
, and the recording to save to the SDcard.
Java code:
@Override public void OnCreate () {//Get phone service Telephonymanager manager = (Telephonymanager) getsystemservice (context.te
Lephony_service);
The status of the telephone listener Manager.listen (new MyListener (), phonestatelistener.listen_call_state);
Private Final class MyListener extends Phonestatelistener {private String num; Private
Copy Code code as follows:
Get the phone's IMSI code
Telephonymanager Telmanager = (telephonymanager) getsystemservice (Telephony_service);
String Sendnum=null;
String Imsi=telmanager.getsubscriberid ();;
if (IMSI!= null) {
if (Imsi.startswith ("46000") | | | imsi.startswith ("46002")) {
Because the IMSI of mobile network number 46000 has been used up, so virtual a 46002 number, 134/159th segment
This example describes Android's approach to acquiring information about mobile phone SIM card operators, which is of practical value for Android programming. Share for everyone to use for reference. The specific methods are as follows:
The main functional code is as follows:
/**
* Get SIM card operator
* *
@param context
* @return
/public static String Getoperators Context) {
Telephonymanager TM = (
Signal-intensity monitoring is a very common feature of Android phones. Today, this article shows an example of how Android realizes signal intensity monitoring. Share to everyone for your reference.
The specific implementation code is as follows:
Telephonymanager Tel;
Myphonestatelistener MyListener;
/* Update the Listener, and start it *
/MyListener = new Myphonestatelistener ();
Tel = (Telephonymanag
replace the ESN (electronic serial number) (Electronic serial number) unique number, which is used to identify the unique identification number associated with all GSM and UMTS network mobile users in CDMA handsets (International Mobile user identification Code) if you need to retrieve the ID of the device, use the following code in your project:
Meid
ESN
IMSI[Java] View plain copy importandroid.telephony.telephonymanager; importandroid.content.context; String imeistring=null; stri
This article illustrates the usage of the Android network data switch. Share to everyone for your reference, specific as follows:
This part of the interface is not open in the API. So you can use this method, true to turn on, false to close. Currently on the G-Net mobile phone can.
Public Boolean setmobiledataenabled (Boolean enabled) {
final telephonymanager Mtelmanager;
Mtelmanager = (Telephonymanager
The /** determines whether the emulator is. If true, it is currently the emulator * @param context * @return */
code is as follows
copy code
public static Boolean Isemulator (context context) { Telephonymanager TM = (Telephonymanager) context.getsystemservice (context.telephony_ SERVICE); String IMEI = Tm.getdeviceid (); if (IMEI = null | | imei.equals ("0000
This article describes the Android implementation of the method of listening to phone call status. Share to everyone for your reference. Specifically as follows:
To add permissions in the manifest file Androidmanifest.xml:
Copy Code code as follows:
The Java code is as follows:
Access to telephone service
telephonymanager Telmanager = (telephonymanager) getsystemservice (context.telephony_
Telephonymanager Telmanager = (telephonymanager) getsystemservice (Context.telephony_service);/**Get the IMSI code of the SIM card* SIM card Unique identification: IMSI International Mobile User identification number (imsi:international Mobile subscriber identification number) is a sign that distinguishes mobile users,* Stored in SIM card, can be used to distinguish the effective information of mobile users
* Android.telephony.TelephonyManager ClassRole:Access information on the Telephony service on your deviceGet method:Context.getsystemservice (Context.telephony_service) get* Gsmcelllocation ClassFunction: Package GSM mobile phone base station informationSpecific code implementation:Get Telephonymanager InstanceTelephonymanager Tmanager = (telephonymanager) context.getsystemservice (Context.telephony_service
can perform carrier provisioning Tasks on Android device. These APIs provide a secure and flexible A-carrier-developed apps to perform these tasks and is distributed through Google Play. Apps, use these functions must is signed by a certificate that matches the certificate in the device ' s Universal integ Rated Circuit Card (UICC).The carrier service APIs has been added to the class, the TelephonyManager SmsManager class, and the new CarrierMessagi
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.