corresponding permission inside the androidmanifest.xml. For example, receive SMS:The following is a dynamically registered Callreceiver code to receive incoming calls for broadcast processing:One way is to read Intent.getstringextra ("Incoming_number") directly to get the caller number:public class Callreceiver extends Broadcastreceiver {@Overridepublic void OnReceive (context context, Intent Intent) {Telephonymanager Telemanager = (
broadcast the phone, the first to get the local number attribution, and then get the broadcast number of the attribution, two number of attribution to the comparison, if the attribution is inconsistent, then add 17951 or 17911.First of all, we have to take a look at the local number, we now define a public variable in the activityPublic String Nativephonenumber;In the OnCreate method, we get the number of the machine.Private String Getnativephonenumber () {
JD-GUI switch code. In fact, not just switch, sometimes the JD-GUI code is not very good-looking, this time you have to combine smali Code together for analysis. Ii. CrackMe analysis start to dissect the CrackMe. First, use the ApkTool GUI to decompile the apk file and view AndroidManifest. xml to know that the MainActivity class is Main. Then extract the classes from the APK package using the decompression software. dex and convert it to the jar package, you can use the JD-GUI to view the Java
, can be canceled in the program, in the Ondestroye call the following function:Copy CodeThe code is as follows:if (connectionreceiver! = null) {Unregisterreceiver (Connectionreceiver);}Ps: There are a lot of ways to use Telephonymanager on the Internet, as follows (but I've tried several times and I've had problems, such as automatically receiving a signal that the network is disconnected each time I enter an activity for the first time. Multiple cal
Telephonymanager Class: The service class that manages the phone call status, the telephone network information, gets the method as follows: telephonymanager manager= (Telephonymanager) getsystemservice (Context.telephony_service) Common methods: Listen (Phonestatelistener listener,int events) to monitor call status
Smsmanager: Short Message service class, com
As we all know, each mobile phone has its own string, which is the only one in the world. Even if the same brand and model are the same, they will not be the same. This Code is the iemi code.
With the IMEI code, we can easily distinguish each machine from its owner and user. The IMEI code cannot be modified by the user. Therefore, it prevents "cheating" users to a large extent. For example, we can use the iemi code for login verification.
Some of my previous projects involved androidpad. I can
) {if (bh.getState() != BluetoothHeadset.STATE_CONNECTED) {bh.close();return;}bh.close();}// Make sure the phone is still ringingTelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);if (tm.getCallState() != TelephonyManager.CALL_STATE_RINGING) {return;}// Answer the phonetry {answerPhoneAidl(context);}catch (Exception e) {e.printStackTrace();Log.d("AutoAnswer","Error trying to answer using telephony service. Fa
GPS Positioning can provide accurate and detailed data. But sometimes we cannot get data through GPS, such as in the room, without GPS functions. Then we need other positioning methods. base station positioning is a good choice. When our mobile phone is turned on, the mobile phone will automatically contact the most signal wireless communication station, registration information, this communication station is what we call the base station, each base station has its own ID, we can find the locati
onlistitemclick (listview L, view V, int position, long ID ){Static final int column_index_number = 4; | intent = new intent (this, calldetailactivity. Class );| Intent. setdata (contenturis. withappendedid (calllog. CILS. content_uri, ID ));@ Override | startactivity (intent );Protected void oncreate (bundle icicle) {|}Start a calldetailactivity. On the calldetailactivity interface, if the current phone number is idle, send an action_call_privileged directly to outgoingcallbroadcaster.
class inherits from Droidap. Java code still follows the object-oriented idea. The two parameters of that method are java objects and js objects. Then, we can use java objects in js. Other java objects associated with that java object can be obtained and used directly. This interface is like a js hole leading to java. the java objects you can see through this hole can be directly used in js.
The following is an example program:
Package com. yelbosh. plugin;
Import org. apache. cordova. DroidGa
Mobile Security Guard ------ sim card binding reading contacts on the mobile phone anti-theft page, ------ sim
Implemented functions:
SIM card binding
Read contacts
Technical points:
SIM card binding
Get boot Broadcast
Read contacts
Use of SimpleAdapter
Data transfer between activities
SIM card binding
Ideas:
Create a TelephonyManager object
TelephonyManager manager = (
Use JAVA code to obtain some basic information about the mobile phone (the local number, SDK version, system version, and mobile phone model) and javasdk
The Code is as follows:
Package com. zzw. getPhoneInfos; import android. app. activity; import android. content. context; import android. OS. build; import android. OS. bundle; import android. telephony. telephonyManager; import android. util. log; public class MainActivity extends Activity {@ Overri
return CTX. getpackagemanager (). getpackageinfo (CTX. getpackagename (), 0). versioncode;6} catch (namenotfoundexception e ){7 // todo auto-generated Catch Block8 return-1;9}10}11}
Sometimes, we may need to obtain some data from the mobile phone system to select the corresponding update data or collect statistics. The more data we get, the more favorable we will provide users with more accurate update options.
1 public class phonestatus {2 // obtain the IMEI number of the mobile phone3 protect
1.ActionBarBasic useNew activity to inherit from Actionbaractivity, get a Actionbar instance when you want to import V7 under the package Getsupportactionbar ();Search and share the action Bar(Note: Due to eclipse, various errors were encountered while importing the V7 package, Actionbar part is temporarily skipped)Navigation bar2. Telephone ServiceTelephonymanagerMonitor phone status CodesMainactivityPackage Com.example.telephonytest;import Android.app.activity;import Android.content.context;im
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.