Telephonymanager Telmanager =(Telephonymanager) Getsystemservice (context.telephony_service);/**Get SIM card IMSI * SIM card Unique ID: IMSI International Mobile Subscriber Identification Number (imsi:international Mobile subscriber Identification number) is the logo that distinguishes the mobile user, * Stored in a SIM card that can be used to distinguish valid information from a mobile user. IMSI is compo
Android development needs to be adapted to mobile phones and tablets, and some needs to be judged when the device is mobile or tablet.Many on the internet say through the device size, DPI, version number, whether the telephone function, etc. to judge, but are not too accurate.Here's a simple way to share your strength (official usage):/**@param @return */public static Boolean Ispad (context context) { return (Context.getresources (). GetConfiguration (). Screenlayout Configuration
How do I intercept a call and automatically hang up when certain numbers are detected?Use reflection technology to access the internal features of the Android SDK to hang up the phone1. The OnReceive () method of the broadcast receiver class (INCALLRECEIVER) that intercepts incoming calls1 Public voidOnReceive (FinalContext context,intent Intent) {2 //Get a phone management service to get phone status3Telephonymanager tm=(Telephonymanager) Context.g
/**
* Obtain Base Station Information
* @ Return
* @ Throws exception
*/
Public scell getcellinfo () throws exception {
Scell cell = new scell ();
Telephonymanager mtelnet = (telephonymanager) getsystemservice (context. telephony_service );
Gsmcelllocation location = (gsmcelllocation) mtelnet. getcelllocation ();
If (location = NULL)
Throw new exception ("the base station information is empty ");
String ope
1) read imsi, IMEI, and mobile phone number:
TelephonyManager tm = (TelephonyManager)
this
.getSystemService(Context.TELEPHONY_SERVICE);
String deviceid = tm.getDeviceId();
String tel = tm.getLine1Number();
String imei =tm.getSimSerialNumber();
String imsi =tm.getSubscriberId();
NOTE:
Not all mobile phone numbers can be obtained. Only some of them can be obtained. This is because the mobile operator di
("onlocationchanged", location. getlatitude () + "," + location. getlongpolling ();} public void onstatuschanged (string provider, int status, bundle extras) {} public void onproviderenabled (string provider) {} public void onproviderdisabled (string provider) {}}; locationmanager. requestlocationupdates (locationmanager. gps_provider, 0, 0, locationlistener );}
The first thing you need to note about GPS is to enable GPS and manifest in your mobile phone positioning settings. the relevant permi
ensure that the algorithms cannot be obtained by third parties through decompilation.
The following describes the implementation of each link in detail.Device unique identity confirmation
The unique serial number of a device may have different acquisition methods on different systems. By combining the CPU serial number, IMEI serial number, MAC address, and other methods, you can generate different identifiers for each device, for example, in Android, an serial number can be generated by combini
);
Getunlockmode obtains the lock type. There are usually three types:
Enumunlockmode {
Pattern,
Sinpin,
Account
}
Createunlockscreenfor (unlockmode) calls the corresponding unlock screen based on the corresponding unlockmode.
Press red to start
Click the end call key (red key) and follow the action:
Telephonymanager. action_phone_state_change and telephonymanager. extra_state_idle
Call frameworks/pol
. However, obviously exposing DeviceID will make some users dissatisfied, so it is best to encrypt these IDs. In fact, the encrypted serial number can still uniquely identify the device and does not explicitly expose the user's specific device. For exampleString. hashcode (), combined with UUID:
1
final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY
// ① Get the telephone management service first
tm= (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
// ② Perform registration listening and action
tm.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
// ③ Define a service to listen for incoming calls
Private class MyListener extends PhoneStateListener {@ Overridepublic void onCallStateChanged (int state, String incomingNumber) {super. onCallStateChanged (state, incomingNumb
) mActivePhone ). mCi; // use the object of a specific object (here is the object of GSMPhone .......} @ Override public ServiceState getServiceState () {return mActivePhone. getServiceState (); // call a specific object (here is the object of GSMPhone) to complete the function @ Override public CellLocation getCellLocation () {return mActivePhone. getCellLocation ();}/*** @ return all available cell information or null if none. * // @ Override public List
Let's see how the client is used:
P
) {siv_sim_bound.setCheck (false);} else {siv_sim_bound.setCheck (true);} siv_sim_bound.setOnClickListener (new View. onClickListener () {@ Override public void onClick (View view) {// 3. obtain the original method boolean isCheck = siv_sim_bound.isCheck (); // 4. reverse the original status // 5, and set the status to the current entry siv_sim_bound.setCheck (! IsCheck); // 6, storage (Serial card number) // 6.1 get SIM card serial number TelephoneManager if (! IsCheck) {
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.