Project Address: Https://github.com/wlkdb/GA_network_info
Click to open link
1, the entire app is divided into android client, Java Server and data layer, the client and the server call the data layer to complete data-related functions.
Data layer includes data format, data network transmission, database reading and writing.
2, the data format module defines a series of data classes, each containing its corresponding parameters and methods, and its database read and write interactive method is also in it. There is also an info class responsible for storing the data currently being processed and some string constants.
3, the network transmission module first defines an abstract class, as the parent class of other network transmission classes, which defines the basic parameters and methods of network transmission.
On this basis, a series of classes are defined to deal with specific network transmission tasks, mainly implementing the Run_clienttoserver () and Run_servertoclient () methods. Client Calls Run_clienttoserver (), the server calls run_servertoclient ().
in the run_servertoclient () then invokes the method in the corresponding database module to read and write to the database.
In addition, network_factory is defined in the network communication module, which can invoke the corresponding network communication class according to the string, so as to make the server handle the client's request conveniently.
Also defines an abstract class Networkendab to the client implementation, whose Isend () method is called at the end of the Network_ab's Clienttoserver () method to allow the client to respond to the data returned by the service side.
4, the database module also first defines an abstract class Dbab, sets the basic parameters and methods, on this basis defines a series of classes to process the specific data.
The database reading and writing method in the corresponding data format is called in the specific processing.
5, as shown above, the data layer of the project includes data format definition, data network transmission and database reading and writing, on this basis to develop the client and the server is very easy. This data layer can also be reused in other Android apps that need to handle more data, and is now open source with the following address:
Https://github.com/wlkdb/GA_network_info
Click to open link
An Android group notification app's data frame