Service-related knowledge
Service is an application component.
Service has no graphical interface
The Service is usually used to process some time-consuming operations. You can use the Service to update ContnetProvider, send Intent notifications, and start system notifications.
The Service is not a separate process, and the Service is not a thread.
Service Lifecycle
The lifecycle of the Android Service is not as complex as the Activity in Android, because it only inherits the onCreate (), onStart (), and onDestroy () methods. When we start the Service for the first time, the onCreate () and onStart () methods are called successively. when the Service is stopped, the onDestroy () method is executed. Note that if the Service has been started, when we start the Service again, we will not execute the onCreate () method, but directly execute the onStart () method.
1. public IBinder onBind (Intent arg0) binds a Service to an Activity
2. Called when public void onCreate () creates a Service object
3. public int onStartCommand (Intent intent, int flags, int startId) called when the object is started or restarted
4. public void onDestroy () is called when a Service object is destroyed.
The Service must be registered in the AndroidManifest. xml registration file.
Java code
- <Service android: name = ". FirstService"> </service>
- Detach an Activity
- Adb uninstall com. bjl. Activity25
1. the StartService () method is used in the Started Service to call the method. There is no connection between the caller and the Service. Even if the caller exits, the Service continues to [onCreate ()-> onStartCommand () -> startService ()-> onDestroy ()]. Note that there is no onStart (), which is mainly replaced by the onStartCommand () method. The onStart method is not recommended.
2. bindService uses the bindService () method to bind the service. When the caller and the biner are bound together, the consumer terminates the [onCreate ()-> onBind ()-> onUnbind () -> onDestroy ()].
Server-related knowledge and principles
Hello, first give the server definition:
Definition: a computer in a LAN that runs management software to control access to network or network resources (disk drives, printers, etc, it can also provide resources for computers on the network to operate as a workstation.
Purpose: Listen for service requests submitted by other computers (clients) on the network and provide corresponding services. To this end, the server must be able to undertake the service and ensure the service. It is a high-availability computer on the network that provides various services for client computers. It is under the control of the network operating system, share the hard drive, tape, printer, Modem, and various dedicated communication devices connected to it with customer sites on the network, it can also provide network users with services such as centralized computing, information publishing, and data management. Its high performance is mainly reflected in the high-speed computing capability, long-time reliable operation, and powerful external data throughput capabilities. The composition of server servers is similar to that of microcomputer, including processors, hard disks, memory, and system bus. They are specially formulated for specific network applications, therefore, the processing capability, stability, reliability, security, scalability, and manageability of servers and computers vary greatly. Especially with the advancement of information technology, the role of the network becomes more and more obvious, and the requirements for data processing capabilities and security of their own information systems are also increasing, if your password is stolen by hackers during the e-commerce process and key business data is lost, if you cannot access the ATM normally, you should consider the server, the successor behind these device systems, rather than blaming the staff for their quality and other objective conditions.
Hope to help you!
Reference: baike.baidu.com/view/899.htm
Learn about the server.
First, are you sure what you are doing? What are the requirements for configuring server bandwidth? The price is not the deciding factor. The service stability is important. In general, purchasing server hosting on your own is affordable, but you need a stable IDC. if a stable environment cannot be found, it will be troublesome to check the server every day.