Android system mobile device positioning real-time acquisition implementation method
By combining the built-in GPS module and Uniapp framework to generate AAR plug-ins in Android mobile devices, the problem of inaccurate positioning points in Uniapp development is solved, and real-time precise positioning of the device and improvement of development efficiency is achieved.
Patent Information
- Application Number
- CN202411375475.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-17
AI Technical Summary
When developing APPs using Uniapp framework, the positioning points caused by the built-in positioning acquisition module are inaccurate, with large errors, and cannot accurately calculate the trajectory and route, and are inaccurate when marking the device location on the map.
By obtaining latitude and longitude information based on the built-in GPS module in Android mobile devices, combining native Android development tools and Uniapp official modules to generate AAR plug-ins, integrating and encapsulating, directly calling the encapsulated positioning and acquisition method to obtain accurate latitude and longitude information, and Connect to the server server module through Uniapp framework module for batch upload and deduplication.
Real-time accurate positioning of mobile devices is achieved, the server processing pressure is reduced, the probability of collection points is reduced, the equipment traffic is saved, and development efficiency and cost-effectiveness is improved.
Smart Images

Figure CN119322643A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a method for implementing real-time acquisition of positioning of an Android system mobile device. Background Art
[0002] Uniapp is a cross-platform development framework based on the Vue.js framework. Since Uniapp allows developers to use one set of code to build applications on multiple platforms such as iOS, Android, H5, and mini programs, many APP developers currently choose to use the uniapp framework for development.
[0003] At present, many APPs use positioning plug-ins based on their own positioning collection modules during the development process using the uniapp framework. They often obtain positioning through network base station positioning. Therefore, the errors in the longitude and latitude of the positioning points collected are relatively large, and the errors are often several kilometers. The positioning points obtained are inaccurate. When using inaccurate positioning points to calculate the trajectory and route kilometers, the errors are relatively large compared to the actual situation, making it impossible to accurately calculate the workload of line patrols, and there is no way to accurately mark the current location information of the device on the map, so the usage is relatively unchanged. Summary of the invention
[0004] The purpose of the present invention is to provide a method for implementing real-time location collection of an Android system mobile device, so as to solve the problem of inaccurate location points and large errors caused by using a built-in location collection module in the development process as mentioned in the above background technology.
[0005] To achieve the above purpose, the present invention provides the following technical solutions: a method for implementing real-time location collection of an Android mobile device, comprising the following steps: step 1, obtaining the current longitude and latitude information of the device based on the underlying GPS module of the device; step 2, using native Android development tools to combine relevant functional modules with the modules officially provided by Uniapp, and uniformly package and generate an AAR plug-in; step 3, using Uniapp tools to integrate with the generated AAR plug-in; step 4, directly calling the self-encapsulated location collection method during the use of the device, and combining it with the longitude and latitude obtained by the GPS module of the device, so as to accurately obtain the longitude and latitude information of the device;
[0006] Preferably, the method is implemented using the following modules, including an Android native development tool module, a Uniapp framework module, and a server module.
[0007] By adopting the above technical solution, multiple modules can be used to obtain real-time positioning information of mobile devices.
[0008] Preferably, the Android native development tool module is combined with the Uniapp official module to generate an AAR plug-in.
[0009] By adopting the above technical solution, an AAR plug-in can be generated by combining the Android native development tool module with the Uniapp official module.
[0010] Preferably, the code flow of the Android native development tool module generating a plug-in is as follows:
[0011]
[0012]
[0013] And the following code:
[0014]
[0015]
[0016] By adopting the above technical solution, an AAR plug-in can be generated.
[0017] Preferably, the Uniapp framework module is connected to the server module to realize batch uploading of data from the Uniapp framework module to the server module. The Uniapp framework module integrates the AAR plug-in generated by the Android native development tool module with the Uniapp official tool plug-in. The code flow of the Uniapp framework module integrated plug-in is as follows:
[0018]
[0019]
[0020] And the following code:
[0021]
[0022]
[0023]
[0024] By adopting the above technical solution and integrating the AAR plug-in generated by the Android native development tool module using the Uniapp framework module, a special positioning collection method plug-in can be encapsulated to facilitate accurate acquisition of the latitude and longitude information of the mobile device.
[0025] Compared with the prior art, the invention has the following beneficial effects: the method for implementing real-time location acquisition of an Android system mobile device:
[0026] 1. The present invention obtains the initial longitude and latitude information of the mobile device based on the positioning chip of the device itself, and compares and calibrates the longitude and latitude information obtained by the positioning chip of the device itself with the positioning information obtained by the Android native AAR plug-in, thereby obtaining real-time and accurate positioning information of the mobile device;
[0027] 2. In the present invention, the native Android development tool is combined with the UniPlugin toolkit to generate an AAR plug-in, and the generated AAR plug-in is integrated using the UniPlugin framework to encapsulate a plug-in with relevant positioning functions. The encapsulated AAR plug-in can be expanded and customized in the later stage, and the encapsulated code can be repeatedly loaded and used in multiple projects, saving development time and development costs and improving development efficiency;
[0028] 3. In the present invention, the Uniapp framework module is connected to the server module, and the collection point information is uploaded in batches through the terminal of the server module, thereby reducing the server processing pressure and the probability of collection point loss. Through terminal batch uploading and deduplication processing, communication with the server is reduced and device traffic is saved. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a schematic diagram of the structure of the steps of the present invention;
[0030] Figure 2 The figure is a schematic diagram of the structure of the data verification algorithm implementation process of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] See also Figure 1-2 The present invention provides a technical solution: a method for implementing real-time location collection of an Android system mobile device.
[0033] The following steps are included: Step 1: Get the current longitude and latitude information of the device based on the underlying GPS module of the device; Step 2: Use the native Android development tool to combine the relevant functional modules with the modules officially provided by Uniapp, and uniformly package and generate an AAR plug-in; Step 3: Use the Uniapp tool to integrate with the generated AAR plug-in; Step 4: During the use of the device, directly call the self-encapsulated positioning acquisition method, and combine it with the longitude and latitude obtained by the GPS module of the device, so as to accurately obtain the longitude and latitude information of the device;
[0034] like Figure 1 As shown, when the method is used to obtain the positioning information of the device, the native Android development tool is used to generate an AAR plug-in for the positioning function, and the generated AAR plug-in is integrated using the Uniapp tool to integrate the functions and encapsulate the AAR plug-in. When the mobile device is provided with a positioning service, the ARR plug-in is installed in the mobile device, and the positioning information of the basic longitude and latitude of the device is obtained based on the positioning chip of the device. The device calls the positioning method of the generated AAR plug-in to obtain the longitude and latitude positioning information of the device in real time, and the obtained positioning information is combined with the information obtained by the positioning chip of the device to obtain a more accurate positioning of the device. By integrating and encapsulating the functions of the AAR plug-in generated by the Android native development tool, the plug-in can be expanded and customized later, and can be repeatedly loaded and used between multiple projects, thereby saving development time and development costs, improving development efficiency, and uploading the information in batches to the terminal in the server module for storage. The terminal uploads the collection point information in batches to reduce the processing pressure of the server and reduce the probability of loss of the collection point. At the same time, the terminal batch uploads and deduplication processing can also reduce the communication with the server, thereby saving device traffic.
[0035] The method is implemented using the following modules, including the Android native development tool module, the Uniapp framework module, and the server module. The Android native development tool module combines the Uniapp official module to generate an AAR plug-in. The code flow of the Android native development tool module to generate a plug-in is as follows:
[0036]
[0037]
[0038] And the following code:
[0039]
[0040]
[0041] The Uniapp framework module is connected to the server module to achieve batch upload of data from the Uniapp framework module to the server module. The Uniapp framework module integrates the AAR plug-in generated by the Android native development tool module with the Uniapp official tool plug-in. The code flow of the Uniapp framework module integration plug-in is as follows:
[0042]
[0043]
[0044] And the following code:
[0045]
[0046]
[0047] like Figure 2 As shown, the Android native development tool module is used in conjunction with the toolkit in the Uniapp framework module, the above code is used to package and generate an AAR plug-in, and the AAR plug-in is integrated through the Uniapp framework module through the above code. The integrated AAR plug-in can be implanted in a mobile device for use, and in conjunction with the device's own positioning chip, the mobile device can be accurately positioned in real time.
[0048] Working principle: When using this method to obtain the positioning information of the device, first develop an AAR plug-in, use the native Android development tool to generate an AAR plug-in with the positioning function, and use Uniapp's tool to integrate it, encapsulate the AAR plug-in, and implant it in the device for use. The device uses its own positioning chip to obtain the basic longitude and latitude positioning information of the device, and uses the AAR plug-in to obtain the longitude and latitude positioning information of the device in real time. The obtained positioning information is combined with the information obtained by the device's own positioning chip to obtain a more accurate positioning of the device. For the encapsulated AAR plug-in, the plug-in can be expanded and customized later, and the AAR plug-in can be repeatedly loaded and used between multiple projects, thereby saving development time and development costs and improving development efficiency.
[0049] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for implementing real-time location acquisition of an Android mobile device, characterized in that: The following steps are involved: Step 1: Get the current latitude and longitude information of the device based on the underlying GPS module of the device; Step 2: Use native Android development tools to combine relevant functional modules with the modules officially provided by Uniapp, and package them uniformly to generate AAR plug-ins; Step 3: Use the Uniapp tool to integrate with the generated AAR plug-in; Step 4: When using the device, directly call the self-encapsulated positioning collection method and combine it with the longitude and latitude obtained by the device's built-in GPS module to accurately obtain the longitude and latitude information of the device.
2. The method for real-time acquisition of positioning of an Android mobile device according to claim 1, characterized in that: The method is implemented using the following modules, including an Android native development tool module, a Uniapp framework module, and a server module.
3. The method for real-time acquisition of the location of an Android mobile device according to claim 2, characterized in that: The Android native development tool module is combined with the Uniapp official module to generate an AAR plug-in.
4. The method for real-time acquisition of the location of an Android mobile device according to claim 3 is characterized in that: The code flow of generating plug-ins by the Android native development tool module is as follows: And the following code:
5. The method for real-time acquisition of Android system mobile device location according to claim 2 is characterized in that: The Uniapp framework module is connected to the server module to realize batch uploading of data from the Uniapp framework module to the server module. The Uniapp framework module integrates the AAR plug-in generated by the Android native development tool module with the Uniapp official tool plug-in. The code flow of the Uniapp framework module integrated plug-in is as follows: And the following code:
Citation Information
Cited By
Method for realizing off-line speech synthesis based on unit-app framework
CN121260144A