Getting started with Android
Getting started with Android
3G, 4G
The third Generation mobile communication technology (3rd-Generation) has a speed of several hundred Kbps, greatly improving the data transmission speed compared with the previous 2G and 2g. The fourth Generation of mobile communication technology (4th-Generation) can speed up to Mbps or more, almost meeting the needs of all data transmission.
Currently, there are three mainstream 3G technical standards:
WCDMA: over 80% of global 3G networks use this standard. China Unicom operation. 186 cdma 2000: at present, Japan, South Korea and North America are widely used. China Telecom. 189 TD-SCDMA: China's proprietary intellectual property rights of 3G communication technology. China Mobile Operations. 188
Currently, the mainstream 4G technology is LTE, but it has not been widely used:
GSM → GPRS → EDGE → WCDMA → HSDPA + → LTE
What is Android?
Software stack memory of mobile devices, including
A complete key application of the operating system Middleware
Linux Kernel
Security management memory management process management power management hardware driver
Android Architecture
Applications: desktop Applications, phone Applications, browsers, and other Applications (such as ActivityManager, WindowManager, ContentProvider, ResourceManager, and other Libraries: SQLite library, SurfaceManager, WebKit, and OppenGL.
Android Runtime
Core Libraries Dalvik Virtual Machine Linux Kernel: hardware driver, power management, etc.
Differences between Dalvik VM and JVM
Format of the compiled file:
JVM:. java->. class->. jar Dalvik:. java->. class->. dex->. odex is based on different architectures.
JVM stack-based architecture (stack memory) Dalvik register-based architecture (CPU), higher execution efficiency than JVM Dalvik dedicated for mobile platforms for Optimization
The JVM jar package contains many class files, each class file contains header information, constant pool, fields, methods, and so on. The apk contains only one dex, it includes all header information, constant pool, method, and so on. Reading a file in this way is more efficient than reading multiple files to find blocks.
CPU Processor Architecture
X86
Intel AMD ARM
Motorola Samsung
Android project directory structure
Src: source code gen: The file automatically generated by the system. R. java records various resource IDs in the project. res: system resources. All files generate resource IDs in the R file.
Drawable: Image layout: interface layout values: Data anim: defines the XML raw of the animation: Native file assets: Resource path. project is not registered in the R file. properties: used by Eclipse to read the Android version of the project. Earlier versions named default. properties AndroidManifest. xml: inventory file, read during software installation
The four components (Activity, ContentProvider, BroadcastReceiver, and Service) in Android must be declared in this file to register the permissions required by the program. For example: calls, text messages, Internet, access to SD card bin: binary files, including class, resource files, dex, apk, and other proguard. cfg: configuration files used to confuse code to prevent decompilation.
APK Installation Process
Eclipse will. compile java source files. class uses the dx tool. class file. in the dex file, pack the. dexfile and all resources, and sign for the. APK file. Install the. APK file to the virtual machine to complete the program installation and start the program-enable the process-enable the main thread to create the Activity object-execute the OnCreate () method according to main. xml file initialization Interface
Simply put, software installation involves two processes.
Copy some files in the apk to a directory in the system. /data/app/directory, 2. create a folder/data/com. test. helloworld/to save data and configure some information in the registry of the system. data/system/packages. xml
Android Security
An important design point in Android security is that by default, applications do not have the permission to perform harmful operations on other applications, operating systems, or users. These operations include reading/writing users' private data (such as contact information or e-mail), reading/writing files of other applications, performing network access, and maintaining device activity. Therefore, you must apply for permissions for any payment or operations that may be related to user privacy.
Test Category
Unit test> Function test> integration test)
Android unit test
AndroidManifest. configure in xml. Import the junit environment of android to write the test class that inherits the test parent class of Android. AndroidTestCase (AndroidTestCase is used to simulate the runtime environment of a mobile phone, the getContext method in this class can obtain the application context object of the current test class. Therefore, this method must be called after the test framework Initialization is complete) the name of the test method must start with "test" in lower case. If you do not start with "test", you can only click this method to run it separately. If you do not run this method, an exception is thrown for all test methods, exceptions cannot be captured by the test framework.
Note: The tested code can only run on the mobile phone. It sends the information to eclipse after testing on the mobile phone.