Location information modification method, device, storage medium and electronic device

By obtaining the custom location information input by the user and calling the proxy method of the positioning management instance, dynamic update of application location information is solved, and the problem of requiring peripheral tools to simulate geographical location in the existing technology is solved, which improves testing efficiency and reduces cost.

CN113986743BActive Publication Date: 2025-02-07DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111284865.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-01
Publication Date
2025-02-07
Estimated Expiration
2041-11-01

AI Technical Summary

Technical Problem

During the testing process of applications, the existing technology needs to be bound to specific peripheral tools to simulate geographical location, and the parameters of debugging peripheral tools have certain usage costs, which affects testing efficiency.

Method used

Provide a location information modification method, by obtaining the custom location information input by the user, replacing the location information obtained by the location acquisition interface, and calling the location proxy method of the proxy instance corresponding to the position management instance for location modification, realizing dynamic update of location .

Benefits of technology

In the absence of peripheral connection, quickly modify the application location information to improve testing efficiency and reduce testing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986743B_ABST
    Figure CN113986743B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device, storage medium and electronic device for modifying location information, so as to modify location information in an application program without connecting any peripherals during the application program testing process, thereby improving the testing efficiency. The method comprises: obtaining custom location information input by a user; replacing the location information obtained by a location acquisition interface based on the custom location information; and calling a location proxy method of a proxy instance corresponding to a location management instance based on the custom location information to modify the location, wherein the location management instance is generated by instantiating a location management class provided by an operating system, and the proxy instance is generated by setting a proxy for the location management instance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular, to a location modification method, device, storage medium and electronic device. Background Art

[0002] During the application testing process, it is necessary to test the performance of the application in different geographical locations. In the related art, peripheral tools are usually used to simulate the geographical location. For example, when testing applications in the iOS system, Xcode is usually used to simulate the geographical location. However, this method needs to be bound to a specific peripheral tool. If the peripheral tool is not bound, the geographical location simulation cannot be performed, and the parameters of the peripheral tool need to be debugged, which has a certain use cost, thereby affecting the testing efficiency of the application. Summary of the invention

[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0004] In a first aspect, the present disclosure provides a method for modifying location information, the method comprising:

[0005] Get the custom location information entered by the user;

[0006] Replace the location information acquired by the location acquisition interface based on the custom location information;

[0007] Based on the custom location information, call the location proxy method of the proxy instance corresponding to the positioning management instance to modify the location;

[0008] The positioning management instance is generated by instantiating a positioning management class provided by an operating system, and the proxy instance is generated by setting a proxy for the positioning management instance.

[0009] In a second aspect, the present disclosure provides a device for modifying location information, the device comprising:

[0010] The acquisition module is used to obtain the custom location information input by the user;

[0011] A first modification module, used to replace the location information acquired by the location acquisition interface based on the custom location information;

[0012] The second modification module is used to call the location proxy method of the proxy instance corresponding to the positioning management instance based on the custom location information to modify the location, wherein the positioning management instance is generated by instantiating the positioning management class provided by the operating system, and the proxy instance is generated by setting a proxy for the positioning management instance.

[0013] In a third aspect, the present disclosure provides a non-temporary computer-readable storage medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.

[0014] In a fourth aspect, the present disclosure provides an electronic device, including:

[0015] a storage device having a computer program stored thereon;

[0016] A processing device is used to execute the computer program in the storage device to implement the steps of the method in the first aspect.

[0017] Through the above technical solution, during the application test process, the callback method of the proxy instance corresponding to all positioning management instances can be called based on the user-defined location information input to achieve dynamic update of the location, and the location information obtained by the location information interface can be replaced based on the user-defined location information input. In this way, the location information of the application can be quickly modified without external devices connected, thereby improving the test efficiency.

[0018] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:

[0020] Figure 1 It is a schematic diagram of the process of obtaining location information in the related art;

[0021] Figure 2 is a flow chart of a method for modifying location information according to an exemplary embodiment of the present disclosure;

[0022] Figure 3 It is a schematic diagram of the relationship between an instance and a proxy instance in a location information modification method shown in a related art and an exemplary embodiment of the present disclosure;

[0023] Figure 4is a process diagram of a method for modifying location information according to an exemplary embodiment of the present disclosure;

[0024] Figure 5 is a schematic diagram of a process of saving an agent instance in a method for modifying location information according to an exemplary embodiment of the present disclosure;

[0025] Figure 6 is a block diagram of a device for modifying location information according to an exemplary embodiment of the present disclosure;

[0026] Figure 7 It is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0028] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0029] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0030] It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units. It should also be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0032] Taking iOS system as an example, the geographic location can be obtained through the instance of CLLocationManager class. Figure 1 As shown, first instantiate the CLLocationManager class, then set the CLLocationManager proxy. If the application directly obtains the location, obtain the location information in the CLLocationManager. If the geographic location changes and the location in the application needs to be dynamically updated, update the current location information through the proxy method callback.

[0033] That is to say, if the location authorization is passed, you can instantiate the CLLocationManager class provided by the iOS system to obtain the current location information. In addition, after the location is updated, you can also get the latest location information in the CLLocationManager proxy callback method.

[0034] Therefore, the present disclosure proposes a location modification method, which can dynamically update the location by calling the callback method of the proxy instance corresponding to all the positioning management instances based on the user-defined location information input during the application test process, and replace the location information obtained by the location information interface based on the user-defined location information input. In this way, the location information of the application can be quickly modified without the connection of external devices, thereby improving the test efficiency.

[0035] Figure 2 FIG. 1 is a flowchart of a method for modifying location information according to an exemplary embodiment of the present disclosure. Figure 2 , the location information modification method includes:

[0036] Step 201, obtaining user-defined location information input;

[0037] Step 202, replacing the location information obtained by the location acquisition interface based on the custom location information;

[0038] Step 203, based on the custom location information, call the location proxy method of the proxy instance corresponding to the location management instance to modify the location. The location management instance is generated by instantiating the location management class provided by the operating system, and the proxy instance is generated by setting a proxy for the location management instance.

[0039] For example, before step 201 , a visual interface for inputting custom location information may be displayed first, and step 201 may obtain the custom location information input by the user in the visual interface.

[0040] For example, during the testing process of the application, a visualization interface is displayed, and the user can enter the longitude and latitude information as the custom location information to be tested in the visualization interface, such as (127, 45). Alternatively, the user can click on the map provided by the visualization interface, and then obtain the custom location information to be tested based on the longitude and latitude information of the clicked location corresponding to the click operation.

[0041] Of course, the user may also input custom location information through code instructions, which is not limited in the embodiments of the present disclosure.

[0042] After obtaining the custom location information input by the user, the location information of the application can be modified based on the custom location information. There are two situations in which the location modification includes one situation in which the application actively obtains the location information and then performs the location modification based on the custom location information input by the user, and the other situation in which the location modification is performed based on the custom location information input by the user and then fed back to the application. For the former situation, step 202 can be executed to replace the location information obtained by the location acquisition interface based on the custom location information. For the latter situation, step 203 can be executed to call the location proxy method of the proxy instance corresponding to the positioning management instance based on the custom location information to perform the location modification.

[0043] In a possible manner, step 203 may be to first determine the proxy instances corresponding to all the location management instances in the application, and then call the target location proxy method corresponding to the target proxy instance based on the custom location information to trigger the call of the location proxy method corresponding to each proxy instance to modify the location, wherein the target proxy instance is used to uniformly manage the proxy instances corresponding to all the location management instances.

[0044] In this way, each proxy instance can be controlled to perform location updates based on custom location information.

[0045] For example, the location management instance can be obtained by instantiating a class provided by the operating system for implementing location management. For example, in the test scenario of the iOS system, the location management instance can be obtained by instantiating the CLLocationManager class provided by the iOS system. By setting a proxy object for the location management instance, the proxy instance corresponding to the location management instance can be obtained. The proxy instance can correspond to the page or component in the page that needs to be located in the application. For example, if the homepage of the application needs to display location information, the homepage can correspond to a proxy instance, or the business components in the homepage, such as the takeaway component that implements the takeaway business or the taxi component that implements the taxi business, need to display the corresponding content according to the location information, then one business component can correspond to one proxy instance. Therefore, the process of the application can include multiple location management instances and multiple proxy instances corresponding thereto.

[0046] Reference Figure 1 , the related technology is usually that the location management instance obtains the location information from the system's hardware positioning module (such as the GPS module), and then passes the location information to the corresponding proxy instance, and then the proxy instance updates the location, thereby updating the location information of the application for business operations. In this way, refer to Figure 3 The left part shows that a CLLocationManager instance corresponds to a CLLocationManager proxy instance. Figure 3 As shown in the right part, the proxy instances corresponding to all location management instances can be managed uniformly through the target proxy instance BDCLLocationManagerDelegate.

[0047] Therefore, refer to Figure 4 The custom location information input by the user can be passed to the target proxy instance, and then the target proxy instance can control each proxy instance to execute the corresponding proxy setting method by calling the target location proxy method, so as to update the corresponding location information of each proxy instance based on the custom location information input by the user.

[0048] In a possible manner, in response to the proxy setting method corresponding to the location management instance being called, the first hook function corresponding to the location management instance is called, wherein the proxy setting method corresponding to the location management instance is a proxy setting method provided by the operating system. Then, based on the first hook function, the custom proxy setting method is called, and the location management instance and the proxy instance corresponding to the location management instance are saved through the custom proxy setting method. Accordingly, determining the proxy instance corresponding to the location management instance in the application may be: traversing the proxy instance corresponding to each saved location management instance.

[0049] It should be understood that in the embodiments of the present disclosure, it is necessary to perform location updates for the proxy instances corresponding to all the location management instances in the current process based on the custom location information input by the user. Therefore, first, the proxy instances corresponding to the location management instances can be saved, so that each saved proxy instance can be called to perform location updates. However, the proxy instances corresponding to the location management instances in the related art are obtained through the proxy setting method provided by the system, and it is difficult to save the proxy instances. Therefore, the embodiments of the present disclosure propose to set a corresponding first hook function (hook function) for the location management instance, so that when setting the proxy for the location management instance, based on the first hook function, it is possible to jump from the proxy setting method provided by the system to the custom proxy setting method, and then save the obtained proxy instance.

[0050] For example, in the test scenario of the iOS system, the proxy setting method provided by the operating system is the setDelegate: method. First, the corresponding relationship between the setDelegate: method and the custom proxy setting method bd_setDelegate: method can be established through the first hook function. Afterwards, in the process of setting the proxy of the location management instance, in response to the setDelegate: method corresponding to the location management instance being called, the first hook function is called, and then the bd_setDelegate: method is called based on the first hook function, thereby saving the location management instance and the proxy instance corresponding to the location management instance.

[0051] In a possible manner, saving the location management instance and the proxy instance corresponding to the location management instance by a custom proxy setting method may be: by a custom proxy setting method, storing the location management instance and the proxy instance corresponding to the location management instance in a hash table in the form of a key-value pair, wherein the location management instance is the key in the key-value pair and the proxy instance is the value in the key-value pair. Accordingly, traversing the proxy instance corresponding to each saved location management instance may be: traversing the proxy instance corresponding to each location management instance in the hash table.

[0052] It should be understood that the proxy has a one-to-one characteristic, so a location management instance will have a corresponding proxy instance. Therefore, the embodiment of the present disclosure can set the location management instance as a key, and set the proxy instance corresponding to the location management instance as a value to obtain the corresponding key-value pair data. In addition, in order to solve the problem that the proxy instance is strongly referenced and cannot be released in the memory, the obtained key-value pair data can be stored in a hash table MapTable, so that after the proxy instance is strongly referenced, the corresponding memory resources can be released in time, thereby improving the utilization rate of the system memory resources.

[0053] For example, the custom proxy setting method is bd_setDelegate: method, refer to Figure 5In the test scenario of iOS system, whenever the bd_setDelegate: method is called in the CLLocationManager instance, the next step is to store the CLLocationManager instance and the corresponding proxy instance in MapTable. Therefore, after the proxy instance is strongly referenced, the corresponding memory resources can be released in time, improving the utilization rate of system memory resources.

[0054] Through any of the above methods, the location information of the application can be dynamically updated based on the custom location information input by the user. In actual applications, there may also be scenarios where the application actively obtains location information. Therefore, the embodiment of the present disclosure also provides a method for responding to the application's active location acquisition request based on the custom location information input by the user, that is, the location information obtained by the location acquisition interface can be replaced based on the custom location information.

[0055] In a possible manner, after receiving a location acquisition request triggered by an application, step 202 may be: calling a second hook function corresponding to the positioning management instance, and passing the custom location information to the location acquisition interface based on the second hook function, so that the location acquisition interface uses the custom location information as the acquired location information.

[0056] It should be understood that in the related technology, after the application actively initiates a location acquisition request, the proxy instance can feed back the location acquisition request to the positioning management instance, and then the positioning management instance can obtain the corresponding location information from the system's hardware positioning module and return it to the application through the proxy instance.

[0057] In the embodiment of the present disclosure, a second hook function can be set for the positioning management instance. After receiving a location acquisition request triggered by an application, the second hook function can be called, so that the custom location information input by the user can be passed to the location acquisition interface based on the second hook function, so that the location acquisition interface can use the custom location information as the acquired location information.

[0058] For example, a target proxy instance for unified management of each proxy instance may correspond to a location parameter, and the location parameter may be updated based on the custom location information input by the user, so that the custom location information currently input by the user may be saved through the location parameter whenever the user inputs custom location information. Afterwards, when a location acquisition request triggered by an application is received, the custom location information input by the user may be acquired from the location parameter, so that the location information acquired by the location acquisition interface may be replaced by the custom location information input by the user.

[0059] That is to say, after receiving the location acquisition request triggered by the application, the second hook function can be called to transfer to the target proxy instance to obtain the user-entered custom location information, and pass the custom location information to the location acquisition interface corresponding to the positioning management instance. In this way, the location acquisition interface can feed back the custom location information to the application, instead of obtaining the actual location information from the system's hardware location module and feeding it back to the application, so that the custom location modification can be realized.

[0060] In a possible manner, the custom location information may be the longitude and latitude information input by the user. Accordingly, the obtained custom location information is passed to the location acquisition interface so that the location acquisition interface uses the custom location information as the obtained location information. This may be: passing the longitude and latitude information to the longitude and latitude acquisition interface so that the longitude and latitude acquisition interface uses the longitude and latitude information as the obtained location information.

[0061] For example, based on the visual interface, after the user inputs the longitude and latitude information, the target proxy instance is called to save the longitude and latitude information in the location parameters corresponding to the target proxy instance. Afterwards, if a location acquisition request triggered by an application is received, the second hook function corresponding to the positioning management instance can be called, and the corresponding longitude and latitude information can be obtained from the target proxy instance based on the second hook function, and the obtained longitude and latitude information can be passed to the longitude and latitude acquisition interface corresponding to the positioning management instance, so that the longitude and latitude acquisition interface can feed back the longitude and latitude information to the application.

[0062] Therefore, the location information of the location acquisition interface can be replaced by the custom location information input by the user, so that the custom location information input by the user is fed back to the application, instead of obtaining the actual location information from the system's hardware location module and feeding it back to the application. Custom location modification can be implemented within the application without connecting peripherals, reducing testing costs and debugging costs and improving testing efficiency.

[0063] Based on the same concept, the present disclosure also provides a device for modifying location information, which can modify part or all of the electronic device through software, hardware or a combination of the two. Figure 5 , the location information modification device 600 may include:

[0064] The acquisition module 601 is used to acquire the user-defined location information input by the user;

[0065] A first modification module 602, configured to replace the location information acquired by the location acquisition interface based on the custom location information;

[0066] The second modification module 603 is used to call the location agent method of the agent instance corresponding to the positioning management instance to modify the location based on the custom location information;

[0067] The positioning management instance is generated by instantiating a positioning management class provided by an operating system, and the proxy instance is generated by setting a proxy for the positioning management instance.

[0068] Optionally, the second modifying module 603 is used to:

[0069] Determine the proxy instances corresponding to all location management instances in the application;

[0070] The target location proxy method corresponding to the target proxy instance is called based on the custom location information to trigger calling the location proxy method corresponding to each of the proxy instances to modify the location, wherein the target proxy instance is used to uniformly manage the proxy instances corresponding to all positioning management instances.

[0071] Optionally, the device 600 further includes:

[0072] A first calling module, configured to call a first hook function corresponding to the positioning management instance in response to a proxy setting method corresponding to the positioning management instance being called, wherein the proxy setting method corresponding to the positioning management instance is a proxy setting method provided by the operating system;

[0073] A second calling module, used for calling a custom proxy setting method based on the first hook function;

[0074] A saving module, used for saving the positioning management instance and the proxy instance corresponding to the positioning management instance through the custom proxy setting method;

[0075] The second modification module 603 is used for:

[0076] The proxy instance corresponding to each stored positioning management instance is traversed.

[0077] Optionally, the storage module is used to:

[0078] By means of the custom proxy setting method, the location management instance and the proxy instance corresponding to the location management instance are stored in a hash table in the form of a key-value pair, wherein the location management instance is a key in the key-value pair and the proxy instance is a value in the key-value pair;

[0079] The proxy instance corresponding to each of the traversed and saved positioning management instances includes:

[0080] The proxy instance corresponding to each positioning management instance in the hash table is traversed.

[0081] Optionally, the first modifying module 602 is used to:

[0082] Calling the second hook function corresponding to the positioning management instance;

[0083] The custom location information is passed to the location acquisition interface based on the second hook function, so that the location acquisition interface uses the custom location information as the acquired location information.

[0084] Optionally, the custom location information is longitude and latitude information input by a user, and the first modifying module 602 is used to:

[0085] The longitude and latitude information is passed to the longitude and latitude acquisition interface so that the longitude and latitude acquisition interface uses the longitude and latitude information as the acquired position information.

[0086] Optionally, the device 600 further includes:

[0087] A display module, used for displaying a visual interface for inputting custom location information;

[0088] The acquisition module 601 is used for:

[0089] Obtain the user-defined location information input by the user in the visual interface.

[0090] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0091] Based on the same inventive concept, an embodiment of the present disclosure also provides a non-temporary computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any of the above-mentioned location information modification methods are implemented.

[0092] Based on the same inventive concept, the present disclosure also provides an electronic device, including:

[0093] a memory having a computer program stored thereon;

[0094] A processor is used to execute the computer program in the memory to implement the steps of any of the above-mentioned location information modification methods.

[0095] Reference below Figure 7 , which shows a schematic diagram of the structure of an electronic device 700 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0096] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0097] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0098] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0099] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0100] In some embodiments, any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol) can be used for communication, and can be interconnected with any form or medium of digital data communication (e.g., communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), internets (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.

[0101] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0102] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains the custom location information input by the user; replaces the location information obtained by the location acquisition interface based on the custom location information; and calls the location proxy method of the proxy instance corresponding to the positioning management instance based on the custom location information to modify the location, wherein the positioning management instance is generated by instantiating the positioning management class provided by the operating system, and the proxy instance is generated by setting a proxy for the positioning management instance.

[0103] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0104] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0105] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, limit the module itself.

[0106] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0107] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0108] According to one or more embodiments of the present disclosure, Example 1 provides a method for modifying location information, the method comprising:

[0109] Get the custom location information entered by the user;

[0110] Replace the location information acquired by the location acquisition interface based on the custom location information;

[0111] Based on the custom location information, the location proxy method of the proxy instance corresponding to the positioning management instance is called to modify the location, wherein the positioning management instance is generated by instantiating the positioning management class provided by the operating system, and the proxy instance is generated by setting a proxy for the positioning management instance.

[0112] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the method of calling the proxy setting method of the proxy instance corresponding to the positioning management instance based on the custom location information to modify the location includes:

[0113] Determine the proxy instances corresponding to all location management instances in the application;

[0114] The target location proxy method corresponding to the target proxy instance is called based on the custom location information to trigger calling the location proxy method corresponding to each of the proxy instances to modify the location, wherein the target proxy instance is used to uniformly manage the proxy instances corresponding to all positioning management instances.

[0115] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein the method further includes:

[0116] In response to the proxy setting method corresponding to the positioning management instance being called, calling a first hook function corresponding to the positioning management instance, wherein the proxy setting method corresponding to the positioning management instance is a proxy setting method provided by the operating system;

[0117] Calling a custom proxy setting method based on the first hook function;

[0118] Saving the positioning management instance and the proxy instance corresponding to the positioning management instance through the custom proxy setting method;

[0119] The determining the proxy instance corresponding to all the location management instances in the application comprises:

[0120] The proxy instance corresponding to each stored positioning management instance is traversed.

[0121] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 3, wherein the step of saving the location management instance and the proxy instance corresponding to the location management instance by using the custom proxy setting method includes:

[0122] By means of the custom proxy setting method, the location management instance and the proxy instance corresponding to the location management instance are stored in a hash table in the form of a key-value pair, wherein the location management instance is a key in the key-value pair and the proxy instance is a value in the key-value pair;

[0123] The proxy instance corresponding to each of the traversed and saved positioning management instances includes:

[0124] The proxy instance corresponding to each positioning management instance in the hash table is traversed.

[0125] According to one or more embodiments of the present disclosure, Example 5 provides a method described in any one of Examples 1-4, wherein replacing the location information acquired by the location acquisition interface based on the custom location information includes:

[0126] Calling the second hook function corresponding to the positioning management instance;

[0127] The custom location information is passed to the location acquisition interface based on the second hook function, so that the location acquisition interface uses the custom location information as the acquired location information.

[0128] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, wherein the custom location information is longitude and latitude information input by a user, and the method of passing the custom location information to a location acquisition interface based on the second hook function so that the location acquisition interface uses the custom location information as the acquired location information includes:

[0129] Based on the second hook function, the longitude and latitude information is passed to the longitude and latitude acquisition interface, so that the longitude and latitude acquisition interface uses the longitude and latitude information as the acquired location information.

[0130] According to one or more embodiments of the present disclosure, Example 7 provides the method described in any one of Examples 1-4, wherein the method further includes:

[0131] Displays a visual interface for entering custom location information;

[0132] The obtaining of the user-defined location information inputted by the user includes:

[0133] Obtain the user-defined location information input by the user in the visual interface.

[0134] According to one or more embodiments of the present disclosure, Example 8 provides a location information modification device, the device comprising:

[0135] The acquisition module is used to obtain the custom location information input by the user;

[0136] A first modification module, used to replace the location information acquired by the location acquisition interface based on the custom location information;

[0137] The second modification module is used to call the location proxy method of the proxy instance corresponding to the positioning management instance based on the custom location information to modify the location, wherein the positioning management instance is generated by instantiating the positioning management class provided by the operating system, and the proxy instance is generated by setting a proxy for the positioning management instance.

[0138] According to one or more embodiments of the present disclosure, Example 9 provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the methods described in Examples 1-7 when executed by a processing device.

[0139] According to one or more embodiments of the present disclosure, Example 10 provides an electronic device, including:

[0140] a storage device having a computer program stored thereon;

[0141] A processing device is used to execute the computer program in the storage device to implement the steps of any one of the methods described in Examples 1-7.

[0142] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0143] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0144] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Claims

1. A method for modifying location information, characterized in that: The method comprises: Get the custom location information entered by the user; Replace the location information acquired by the location acquisition interface based on the custom location information; In response to the proxy setting method corresponding to the positioning management instance being called, calling a first hook function corresponding to the positioning management instance, wherein the proxy setting method corresponding to the positioning management instance is a proxy setting method provided by the operating system; Calling a custom proxy setting method based on the first hook function; Saving the location management instance and the proxy instance corresponding to the location management instance through the custom proxy setting method; Based on the custom location information, call the location proxy method of the proxy instance corresponding to the positioning management instance to modify the location; Wherein, the positioning management instance is generated by instantiating the positioning management class provided by the operating system, and the proxy instance is generated by setting a proxy for the positioning management instance; The step of saving the location management instance and the proxy instance corresponding to the location management instance by using the custom proxy setting method includes: Through the custom proxy setting method, the positioning management instance and the proxy instance corresponding to the positioning management instance are stored in a hash table in the form of a key-value pair, wherein the positioning management instance is the key in the key-value pair and the proxy instance is the value in the key-value pair.

2. The method according to claim 1, characterized in that The calling of the location proxy method of the proxy instance corresponding to the positioning management instance based on the custom location information to modify the location includes: Determine the proxy instances corresponding to all location management instances in the application; The target location proxy method corresponding to the target proxy instance is called based on the custom location information to trigger calling the location proxy method corresponding to each of the proxy instances to modify the location, wherein the target proxy instance is used to uniformly manage the proxy instances corresponding to all positioning management instances.

3. The method according to claim 2, characterized in that The determining the proxy instance corresponding to all the location management instances in the application comprises: The proxy instance corresponding to each stored positioning management instance is traversed.

4. The method according to claim 3, characterized in that The proxy instance corresponding to each of the traversed and saved positioning management instances includes: The proxy instance corresponding to each positioning management instance in the hash table is traversed.

5. The method according to any one of claims 1 to 4, characterized in that: The replacing the location information acquired by the location acquisition interface based on the custom location information includes: Calling the second hook function corresponding to the positioning management instance; The custom location information is passed to the location acquisition interface based on the second hook function, so that the location acquisition interface uses the custom location information as the acquired location information.

6. The method according to claim 5, characterized in that The custom location information is the latitude and longitude information input by the user, and the method of passing the custom location information to the location acquisition interface based on the second hook function so that the location acquisition interface uses the custom location information as the acquired location information includes: Based on the second hook function, the longitude and latitude information is passed to the longitude and latitude acquisition interface, so that the longitude and latitude acquisition interface uses the longitude and latitude information as the acquired location information.

7. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Displays a visual interface for entering custom location information; The obtaining of the user-defined location information inputted by the user includes: Obtain the custom location information input by the user in the visual interface.

8. A location information modification device, characterized in that: The device comprises: The acquisition module is used to obtain the custom location information input by the user; A first modification module, used to replace the location information acquired by the location acquisition interface based on the custom location information; A first calling module, configured to call a first hook function corresponding to the positioning management instance in response to a proxy setting method corresponding to the positioning management instance being called, wherein the proxy setting method corresponding to the positioning management instance is a proxy setting method provided by the operating system; A second calling module, used for calling a custom proxy setting method based on the first hook function; A saving module, used for saving the positioning management instance and the proxy instance corresponding to the positioning management instance through the custom proxy setting method; A second modification module is used to call a location proxy method of a proxy instance corresponding to the positioning management instance to modify the location based on the custom location information; Wherein, the positioning management instance is generated by instantiating the positioning management class provided by the operating system, and the proxy instance is generated by setting a proxy for the positioning management instance; The storage module is used for: Through the custom proxy setting method, the positioning management instance and the proxy instance corresponding to the positioning management instance are stored in a hash table in the form of a key-value pair, wherein the positioning management instance is the key in the key-value pair and the proxy instance is the value in the key-value pair.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Application test method, device and system, and proxy server

    CN110427323A

  • Test case generation method and device for remote procedure call interface, storage medium and electronic equipment

    CN112328419A