Android broadcast, service, database, notification, package principle and description, android Principle
Introduction
Many mechanisms are used in Android, such as broadcast, service, database, notification, and package ...... And so on.
What is broadcast? Broadcast is a widely used mechanism for transmitting information between applications. Similar to a broadcast station, it receives and sends messages at a specific frequency.
What is a service? Service is one of the four main components in the android system. It has the same Activity level, but cannot run on its own and can only run in the background and interact with other components. For example, background music player.
What database is used? The open-source project sqlite operation data is used in android. SQLite database is an open source embedded database written in C language by D. Richard Hipp. The supported database size is 2 TB.
What notifications? Notification is a common Notification method in Android. When you have unread text messages or missed calls, a prompt icon is displayed in the status bar. You can pull down the status bar to read notifications.
What is a package? Android applications all have packages, which are descriptions of the program.
Details 1. Broadcast BroadcastReceiver
2. Service
Lifecycle
3. Database ContentProvider
4. Notification in the Notification bar
5. Packages
PackageManager is the management class of the package in Android.
The framework is as follows:
What is the difference between android broadcast and service?
The broadcast period is short. You cannot perform time-consuming operations in the broadcast, but the service can. The function of broadcast is to help you send some notifications. For example, if you write a boot broadcast, once the mobile phone is started, the broadcast will send a notification to the mobile phone (the program you wrote ), A mobile phone (a program you write, a class, a code) starts the service. At this time, you can perform time-consuming operations in the service, such as sending requests to the server and loading data. The difference between broadcast and service is that the broadcast cycle is short, and time-consuming operations are not allowed. The service is a persistent connection and time-consuming operation can be performed, for example, the service is used to control the playing of music. Broadcast needs to be registered. There are two methods: one is in the configuration file, the other is code registration, the Service is to write a class inheritance service, and then write your operations in it, the peripheral instantiation service, start the service.
Android client access to PC-side Server databases
You can connect to the database remotely, but this is obviously not a good choice.
Both architecture and security are relatively poor.
Your original method is reasonable.