CN113986743B - Location information modification method, device, storage medium and electronic device - Google Patents
Location information modification method, device, storage medium and electronic device Download PDFInfo
- Publication number
- CN113986743B CN113986743B CN202111284865.1A CN202111284865A CN113986743B CN 113986743 B CN113986743 B CN 113986743B CN 202111284865 A CN202111284865 A CN 202111284865A CN 113986743 B CN113986743 B CN 113986743B
- Authority
- CN
- China
- Prior art keywords
- instance
- proxy
- location
- positioning management
- position information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The disclosure relates to a method, a device, a storage medium and an electronic device for modifying position information, so that the position information is modified in an application program under the condition that no peripheral connection exists in the test process of the application program, and the test efficiency is improved. The method comprises the steps of obtaining user-defined position information input by a user, replacing position information obtained by a position obtaining interface based on the user-defined position information, and calling a position proxy method of a proxy instance corresponding to a positioning management instance to carry out position modification based on the user-defined position information, wherein 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.
Description
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a position modification method, a device, a storage medium and electronic equipment.
Background
During the testing of an application, it is necessary to test the performance of the application at different geographical locations. In the related art, a peripheral tool is typically used to simulate a geographic location, such as testing an application program in an iOS system, and an Xcode is typically used to simulate a geographic location. However, the method needs to be bound with a specific peripheral tool, if the peripheral tool is not bound, geographical position simulation cannot be performed, parameters of the peripheral tool need to be debugged, and certain use cost is achieved, so that the test efficiency of an application program is affected.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In a first aspect, the present disclosure provides a location information modification method, the method comprising.
Acquiring user-defined position information input by a user;
replacing the position information acquired by the position acquisition interface based on the self-defined position information;
calling a position proxy method of a proxy instance corresponding to the positioning management instance based on the self-defined position information to carry out position modification;
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.
In a second aspect, the present disclosure provides a location information modifying apparatus, the apparatus comprising:
the acquisition module is used for acquiring user-defined position information input by a user;
The first modification module is used for replacing the position information acquired by the position acquisition interface based on the self-defined position information;
And the second modification module is used for calling a position proxy method of a proxy instance corresponding to the positioning management instance to carry out position modification based on the self-defined position information, wherein 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.
In a third aspect, the present disclosure provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processing device, implements the steps of the method described in the first aspect.
In a fourth aspect, the present disclosure provides an electronic device comprising:
A storage device having a computer program stored thereon;
processing means for executing said computer program in said storage means to carry out the steps of the method described in the first aspect.
According to the technical scheme, in the testing process of the application program, the callback methods of the proxy instances corresponding to all the positioning management instances can be called based on the user-defined position information input by the user to realize dynamic updating of the positions, and the position information acquired by the position information interface can be replaced based on the user-defined position information input by the user. Therefore, the position information of the application program can be quickly modified under the condition that no peripheral is connected, and the testing efficiency is improved.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
fig. 1 is a schematic diagram of a process of acquiring position information in the related art;
FIG. 2 is a flowchart illustrating a location information modification method according to an exemplary embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a relationship between an instance and an agent instance in a location information modification method according to an exemplary embodiment of the present disclosure;
FIG. 4 is a process diagram of a location information modification method according to an exemplary embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating a process for preserving an agent instance in a location information modification method according to an exemplary embodiment of the present disclosure;
FIG. 6 is a block diagram of a location information modifying device according to an exemplary embodiment of the present disclosure;
fig. 7 is a block diagram of an electronic device, according to an exemplary embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment," another embodiment "means" at least one additional embodiment, "and" some embodiments "means" at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units. It is further noted that references to "one" or "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Taking the iOS system as an example, the geographic location may be obtained by way of an instance of class CLLocationManager. As shown in fig. 1, class CLLocationManager is instantiated and then the CLLocationManager agent is set. If the application directly obtains the location, the location information in CLLocationManager is obtained. If the geographic position is changed and the position in the application program needs to be dynamically updated, the current position information is updated by the agent method back-tuning.
That is, in the case that geographic location authorization passes, the CLLocationManager classes provided by the iOS system may be instantiated to obtain the current location information. In addition, after the geographic position is updated, the latest geographic position information can be obtained in the CLLocationManager proxy callback method.
Therefore, the present disclosure proposes a location modification method, so as to invoke callback methods of proxy instances corresponding to all location management instances based on user-input custom location information to implement dynamic update of locations in a test process of an application program, and replace location information acquired by a location information interface based on user-input custom location information. Therefore, the position information of the application program can be quickly modified under the condition that no peripheral is connected, and the testing efficiency is improved.
Fig. 2 is a flowchart illustrating a location information modification method according to an exemplary embodiment of the present disclosure. Referring to fig. 2, the location information modification method includes:
step 201, obtaining user-defined position information input by a user;
step 202, replacing the position information acquired by the position acquisition interface based on the self-defined position information;
step 203, calling a location proxy method of a proxy instance corresponding to the 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 the operating system, and the proxy instance is generated by setting a proxy for the location management instance.
Illustratively, before step 201, a visual interface for inputting the custom position information may be displayed, and step 201 may acquire the custom position information input by the user at the visual interface.
For example, during the testing process of the application program, a visual interface is displayed, and the user can input latitude and longitude information in the visual interface as the user-defined position information to be tested, for example, input latitude and longitude information is (127,45). Or the user can perform clicking operation in the map provided by the visual interface, and then the user-defined position information to be tested is obtained based on longitude and latitude information of the clicking position corresponding to the clicking operation.
Of course, the user may also input the custom location information by way of code instructions, which are not limited in this disclosure.
After the user-defined position information input by the user is acquired, the position information of the application program can be modified based on the user-defined position information. The position modification includes two cases, one is that the application program actively acquires the position information, so that the position modification is performed based on the user-input user-defined position information, and the other is that the position modification is performed based on the user-input user-defined position information and then the position modification is fed back to the application program. In the former case, step 202 may be performed to replace the location information acquired by the location acquisition interface based on the custom location information. For the latter case, step 203 may be executed to invoke a location proxy method of a proxy instance corresponding to the location management instance to perform location modification based on the custom location information.
In a possible manner, step 203 may be to determine proxy instances corresponding to all positioning management instances in the application program, and then call a target location proxy method corresponding to the target proxy instance based on the custom location information to trigger to call a location proxy method corresponding to each proxy instance for location modification, where the target proxy instance is used for uniformly managing proxy instances corresponding to all positioning management instances.
Thus, each agent instance can be controlled to perform location update based on the custom location information.
By way of example, the location management instance may be derived by instantiating a class provided by an operating system for implementing location management. For example, in the test scenario of the iOS system, the location management instance may be obtained by instantiating the CLLocationManager class provided by the iOS system. And setting a proxy object for the positioning management instance, so that a proxy instance corresponding to the positioning management instance can be obtained. The proxy instance may correspond to a page or a component in a page that needs to be located in the application. For example, if the home page of the application program needs to display position information, the home page may correspond to an agent instance, or a service component in the home page, such as a take-out component for realizing take-out service or a taxi taking component for realizing taxi taking service, needs to display corresponding content according to the position information, and then one service component may correspond to an agent instance. Thus, the application program may include a plurality of location management instances and a plurality of proxy instances corresponding thereto.
Referring to fig. 1, a related art generally obtains location information from a hardware location module (such as a GPS module) of a system by a location management instance, and then transfers the location information to a corresponding proxy instance, and then the proxy instance performs a location update, thereby updating the location information of an application program for performing a business operation. In this manner, referring to the left portion of FIG. 3, one CLLocationManager instance corresponds to one CLLocationManager agent instance. In the embodiment of the present disclosure, referring to the right part of fig. 3, proxy instances corresponding to all positioning management instances may be uniformly managed by the target proxy instance BDCLLocationManagerDelegate.
Thus, referring to fig. 4, user-input custom location information may be transferred into a target proxy instance, and then the target proxy instance may control each proxy instance to execute a corresponding proxy setting method by calling the target location proxy method, so that location information corresponding to each proxy instance may be updated based on the user-input custom location information.
In a possible manner, the first hook function corresponding to the location management instance may also be called in response to the proxy setting method corresponding to the location management instance being called, where the proxy setting method corresponding to the location management instance is a proxy setting method provided by the operating system. Then, a user-defined proxy setting method is called based on the first hook function, and the positioning management instance and the proxy instance corresponding to the positioning management instance are saved through the user-defined proxy setting method. Correspondingly, determining the proxy instance corresponding to the positioning management instance in the application program can be traversing the proxy instance corresponding to each saved positioning management instance.
It should be understood that in the embodiments of the present disclosure, for all proxy instances corresponding to the location management instances in the current process, location update needs to be performed based on the user-defined location information input by the user. Therefore, the proxy instance corresponding to each positioning management instance can be saved first, so that each saved proxy instance is called to update the position. However, the proxy instance corresponding to the positioning management instance in the related art is obtained through a proxy setting method provided by the system, and the storage of the proxy instance is difficult. Therefore, the embodiment of the disclosure proposes to set a corresponding first hook function (hook function) for the location management instance, so that when the proxy is set for the location management instance, the proxy setting method provided by the system can be skipped to the self-defined proxy setting method based on the first hook function, and the obtained proxy instance is further saved.
For example, in the test scenario of the iOS system, the agent setting method provided by the operating system is SETDELEGATE, and the corresponding relationship between SETDELEGATE and bd_ SETDELEGATE of the method can be established through the first hook function. Then, in the process of setting the proxy for the location management instance, responding to SETDELEGATE that the method is called and a first hook function is called, and then, based on the first hook function, the bd_ SETDELEGATE method is called, so that the location management instance and the proxy instance corresponding to the location management instance are saved.
In a possible mode, the positioning management instance and the proxy instance corresponding to the positioning management instance are stored through a custom proxy setting method, namely, the positioning management instance and the proxy instance corresponding to the positioning management instance are stored into a hash table in the form of key value pairs through the custom proxy setting method, wherein the positioning management instance is a key in the key value pairs, and the proxy instance is a value in the key value pairs. Accordingly, traversing the stored proxy instance corresponding to each location management instance may be traversing the proxy instance corresponding to each location management instance in the hash table.
It should be appreciated that agents have a one-to-one nature, so that a location management instance will have a corresponding agent instance. Thus, the embodiment of the disclosure may set the location management instance as a key (key), and set the proxy instance corresponding to the location management instance as a value (value), so as to obtain the corresponding key-value pair data. In addition, in order to solve the problem that the strong reference of the proxy instance cannot be released in the memory, the obtained key value data can be stored in the hash table MapTable, so that after the proxy instance is strongly referenced, the corresponding memory resource can be released in time, and the utilization rate of the system memory resource is improved.
For example, the custom proxy setting method is bd_ SETDELEGATE, referring to fig. 5, in the test scenario of the iOS system, each time the bd_ SETDELEGATE in the CLLocationManager instance has a call, the CLLocationManager instance and the corresponding proxy instance may be stored to MapTable. Therefore, after the proxy instance is strongly referenced, the corresponding memory resource can be timely released, and the utilization rate of the system memory resource is improved.
By any of the above methods, the location information of the application program can be dynamically updated based on the user-defined location information input by the user. In practical applications, there may be a scenario where an application actively acquires location information. Therefore, the embodiment of the disclosure also provides a way to respond to the application program by actively initiating the position acquisition request based on the user-input custom position information, i.e. the position information acquired by the position acquisition interface can be replaced based on the custom position information.
In a possible manner, after receiving the position acquisition request triggered by the application program, step 202 may be to call a second hook function corresponding to the positioning management instance, and transfer the custom position information to the position acquisition interface based on the second hook function, so that the position acquisition interface uses the custom position information as the acquired position information.
It should be understood that, in the related art, after the application program actively initiates the location acquisition request, the proxy instance may feed back the location acquisition request to the location management instance, and then the location management instance may acquire the corresponding location information from the hardware location module of the system and return the location information to the application program through the proxy instance.
In the embodiment of the disclosure, a second hook function may be set for the positioning management instance, and after receiving a position acquisition request triggered by an application program, the second hook function may be called, so that user-defined position information input by a user is transferred to the position acquisition interface based on the second hook function, so that the position acquisition interface uses the user-defined position information as acquired position information.
For example, a target agent instance for unified management of agent instances may correspond to a location parameter that may be updated based on user-entered custom location information, so that the custom location information entered by the current user may be saved by the location parameter whenever the user enters custom location information. And after receiving a position acquisition request triggered by the application program, acquiring the user-defined position information input by the user from the position parameter, so that the position information acquired by the position acquisition interface is replaced by the user-defined position information input by the user.
That is, after receiving the position acquisition request triggered by the application program, the user-defined position information input by the user can be acquired in the target agent instance by calling the second hook function, and the user-defined position information is transmitted to the position acquisition interface corresponding to the position management instance. Therefore, the position acquisition interface can feed back the self-defined position information to the application program instead of acquiring actual position information from a hardware position module of the system, so that the self-defined position modification can be realized.
In a possible manner, the custom position information may be longitude and latitude information input by a user, and correspondingly, the acquired custom position information is transferred to the position acquisition interface, so that the position acquisition interface uses the custom position information as the acquired position information, or the longitude and latitude information is transferred 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.
For example, based on the visual interface, after the user inputs the longitude and latitude information, the longitude and latitude information is saved in the position parameter corresponding to the target agent instance by calling the target agent instance. And then, if a position acquisition request triggered by the application program is received, a second hook function corresponding to the positioning management instance can be called, corresponding longitude and latitude information is acquired from the target agent instance based on the second hook function, and the acquired longitude and latitude information is transmitted to a longitude and latitude acquisition interface corresponding to the positioning management instance, so that the longitude and latitude acquisition interface feeds back the longitude and latitude information to the application program.
Therefore, the position information of the interface can be obtained by replacing the position with the user-defined position information input by the user, so that the user-defined position information input by the user is fed back to the application program instead of obtaining the actual position information from the hardware position module of the system and feeding back to the application program, the user-defined position modification can be realized in the application program under the condition that no peripheral is connected, the test cost and the debugging cost are reduced, and the test efficiency is improved.
Based on the same conception, the present disclosure also provides a location information modifying device, which may be part or all of an electronic device through software, hardware or a combination of the two. Referring to fig. 5, the location information modification apparatus 600 may include:
the acquiring module 601 is configured to acquire user-defined location information input by a user;
a first modification module 602, configured to replace the location information acquired by the location acquisition interface based on the custom location information;
a second modification module 603, configured to invoke a location proxy method of a proxy instance corresponding to the location management instance to perform location modification based on the custom location information;
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.
Optionally, the second modification module 603 is configured to:
Determining the proxy instance corresponding to all the positioning management instances in the application program;
And calling a target location proxy method corresponding to a target proxy instance based on the self-defined location information to trigger and call the location proxy method corresponding to each proxy instance to carry out location modification, wherein the target proxy instance is used for uniformly managing the proxy instances corresponding to all location management instances.
Optionally, the apparatus 600 further includes:
The first calling module is used for calling a first hook function corresponding to the positioning management instance in response to the fact that the proxy setting method corresponding to the positioning management instance is called, wherein the proxy setting method corresponding to the positioning management instance is the proxy setting method provided by the operating system;
the second calling module is used for calling a custom proxy setting method based on the first hook function;
The storage module is used for storing the positioning management instance and the proxy instance corresponding to the positioning management instance through the user-defined proxy setting method;
The second modification module 603 is configured to:
traversing the proxy instance corresponding to each stored positioning management instance.
Optionally, the storage module is configured to:
storing the positioning management instance and the proxy instance corresponding to the positioning management instance into a hash table in the form of a key value pair by the self-defined proxy setting method, wherein the positioning management instance is a key in the key value pair, and the proxy instance is a value in the key value pair;
The traversing the proxy instance corresponding to each location management instance includes:
traversing the proxy instance corresponding to each positioning management instance in the hash table.
Optionally, the first modification module 602 is configured to:
calling a second hook function corresponding to the positioning management instance;
and transmitting the custom position information to a position acquisition interface based on the second hook function, so that the position acquisition interface takes the custom position information as acquired position information.
Optionally, the custom location information is latitude and longitude information input by a user, and the first modification module 602 is configured to:
and transmitting the longitude and latitude information to a longitude and latitude acquisition interface so that the longitude and latitude acquisition interface takes the longitude and latitude information as acquired position information.
Optionally, the apparatus 600 further includes:
The display module is used for displaying a visual interface for inputting user-defined position information;
the acquiring module 601 is configured to:
and acquiring user-defined position information input by a user on the visual interface.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Based on the same inventive concept, the embodiments of the present disclosure also provide a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the above-described location information modification methods.
Based on the same inventive concept, the embodiments of the present disclosure further provide an electronic device, including:
A memory having a computer program stored thereon;
And a processor for executing the computer program in the memory to implement the steps of any of the above-described location information modification methods.
Referring now to fig. 7, a schematic diagram of an electronic device 700 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 7 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 7, the electronic device 700 may include a processing means (e.g., a central processor, a graphics processor, etc.) 701, which may 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 means 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 through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
In general, devices may be connected to I/O interface 705 including input devices 706 such as a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc., output devices 707 including a Liquid Crystal Display (LCD), speaker, vibrator, etc., storage devices 708 including, for example, magnetic tape, hard disk, etc., and communication devices 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 shows an electronic device 700 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 709, or installed from storage 708, or installed from ROM 702. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 701.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to electrical wiring, fiber optic cable, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, communications may be made using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (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.
The computer readable medium may be included in the electronic device or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs, and when the one or more programs are executed by the electronic equipment, the electronic equipment is caused to acquire user-input self-defined position information, replace the position information acquired by a position acquisition interface based on the self-defined position information, and call a position proxy method of a proxy instance corresponding to a positioning management instance to carry out position modification based on the self-defined position information, wherein the positioning management instance is generated through a positioning management class provided by an instantiation operating system, and the proxy instance is generated through proxy setting of the positioning management instance.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented in software or hardware. The name of a module does not in some cases define the module itself.
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 that may be used include Field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems-on-a-chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, example 1 provides a location information modification method, the method comprising:
acquiring user-defined position information input by a user;
replacing the position information acquired by the position acquisition interface based on the self-defined position information;
And calling a position proxy method of a proxy instance corresponding to the positioning management instance to carry out position modification based on the self-defined position information, wherein 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.
According to one or more embodiments of the present disclosure, example 2 provides the method of example 1, wherein the invoking the proxy setting method of the proxy instance corresponding to the location management instance based on the custom location information performs location modification, including:
Determining the proxy instance corresponding to all the positioning management instances in the application program;
And calling a target location proxy method corresponding to a target proxy instance based on the self-defined location information to trigger and call the location proxy method corresponding to each proxy instance to carry out location modification, wherein the target proxy instance is used for uniformly managing the proxy instances corresponding to all location management instances.
In accordance with one or more embodiments of the present disclosure, example 3 provides the method of example 2, the method further comprising:
responding to the call of the proxy setting method corresponding to the positioning management instance, and 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;
Invoking a custom proxy setting method based on the first hook function;
The positioning management instance and the proxy instance corresponding to the positioning management instance are stored through the custom proxy setting method;
The determining the proxy instance corresponding to all the positioning management instances in the application program comprises the following steps:
traversing the proxy instance corresponding to each stored positioning management instance.
According to one or more embodiments of the present disclosure, example 4 provides the method of example 3, wherein the saving, by the custom proxy setting method, the location management instance and the proxy instance corresponding to the location management instance includes:
storing the positioning management instance and the proxy instance corresponding to the positioning management instance into a hash table in the form of a key value pair by the self-defined proxy setting method, wherein the positioning management instance is a key in the key value pair, and the proxy instance is a value in the key value pair;
The traversing the proxy instance corresponding to each location management instance includes:
traversing the proxy instance corresponding to each positioning management instance in the hash table.
According to one or more embodiments of the present disclosure, example 5 provides the method of any one of examples 1 to 4, wherein the replacing the location information acquired by the location acquisition interface based on the custom location information includes:
calling a second hook function corresponding to the positioning management instance;
and transmitting the custom position information to a position acquisition interface based on the second hook function, so that the position acquisition interface takes the custom position information as acquired position information.
In accordance with one or more embodiments of the present disclosure, example 6 provides the method of example 5, wherein the custom location information is latitude and longitude information input by a user, and the transferring the custom location information to a location acquisition interface based on the second hook function, so that the location acquisition interface takes the custom location information as the acquired location information, includes:
and transmitting the longitude and latitude information to a longitude and latitude acquisition interface based on the second hook function, so that the longitude and latitude acquisition interface takes the longitude and latitude information as acquired position information.
According to one or more embodiments of the present disclosure, example 7 provides the method of any one of examples 1-4, further comprising:
displaying a visual interface for inputting user-defined position information;
the obtaining the user-defined position information input by the user comprises the following steps:
and acquiring user-defined position information input by a user on the visual interface.
According to one or more embodiments of the present disclosure, example 8 provides a location information modification apparatus, the apparatus comprising:
the acquisition module is used for acquiring user-defined position information input by a user;
The first modification module is used for replacing the position information acquired by the position acquisition interface based on the self-defined position information;
And the second modification module is used for calling a position proxy method of a proxy instance corresponding to the positioning management instance to carry out position modification based on the self-defined position information, wherein 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.
According to one or more embodiments of the present disclosure, example 9 provides a non-transitory computer-readable storage medium having stored thereon a computer program that, when executed by a processing device, performs the steps of the method of any of examples 1-7.
In accordance with one or more embodiments of the present disclosure, example 10 provides an electronic device, comprising:
A storage device having a computer program stored thereon;
processing means for executing the computer program in the storage means to implement the steps of the method of any one of examples 1-7.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims. The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Claims (10)
1. A method of modifying location information, the method comprising:
acquiring user-defined position information input by a user;
replacing the position information acquired by the position acquisition interface based on the self-defined position information;
responding to the call of an agent setting method corresponding to a positioning management instance, and calling a first hook function corresponding to the positioning management instance, wherein the agent setting method corresponding to the positioning management instance is an agent setting method provided by an operating system;
Invoking a custom proxy setting method based on the first hook function;
the positioning management instance and the proxy instance corresponding to the positioning management instance are stored through the custom proxy setting method;
calling a position proxy method of a proxy instance corresponding to the positioning management instance based on the self-defined position information to carry out position modification;
The method comprises the steps that a positioning management instance is generated through instantiating a positioning management class provided by an operating system, and a proxy instance is generated through setting a proxy for the positioning management instance;
the storing the location management instance and the proxy instance corresponding to the location management instance by the custom proxy setting method includes:
And storing the positioning management instance and the proxy instance corresponding to the positioning management instance into a hash table in the form of a key value pair by the self-defined proxy setting method, wherein the positioning management instance is a key in the key value pair, and the proxy instance is a value in the key value pair.
2. The method according to claim 1, wherein the calling the location proxy method of the proxy instance corresponding to the location management instance based on the custom location information to perform the location modification includes:
Determining the proxy instance corresponding to all the positioning management instances in the application program;
And calling a target location proxy method corresponding to a target proxy instance based on the self-defined location information to trigger and call the location proxy method corresponding to each proxy instance to carry out location modification, wherein the target proxy instance is used for uniformly managing the proxy instances corresponding to all location management instances.
3. The method of claim 2, wherein determining the proxy instance for all location management instances in the application comprises:
traversing the proxy instance corresponding to each stored positioning management instance.
4. A method according to claim 3, wherein traversing the proxy instance corresponding to each of the location management instances stored comprises:
traversing the proxy instance corresponding to each positioning management instance in the hash table.
5. The method according to any one of claims 1-4, wherein replacing the location information acquired by the location acquisition interface based on the custom location information comprises:
calling a second hook function corresponding to the positioning management instance;
and transmitting the custom position information to a position acquisition interface based on the second hook function, so that the position acquisition interface takes the custom position information as acquired position information.
6. The method of claim 5, wherein the custom location information is latitude and longitude information input by a user, and wherein the transferring the custom location information to a location acquisition interface based on the second hook function so that the location acquisition interface takes the custom location information as the acquired location information comprises:
and transmitting the longitude and latitude information to a longitude and latitude acquisition interface based on the second hook function, so that the longitude and latitude acquisition interface takes the longitude and latitude information as acquired position information.
7. The method of any one of claims 1-4, further comprising:
displaying a visual interface for inputting user-defined position information;
the obtaining the user-defined position information input by the user comprises the following steps:
and acquiring user-defined position information input by a user on the visual interface.
8. A location information modifying device, the device comprising:
the acquisition module is used for acquiring user-defined position information input by a user;
The first modification module is used for replacing the position information acquired by the position acquisition interface based on the self-defined position information;
the first calling module is used for responding to the fact that the proxy setting method corresponding to the positioning management instance is called, and 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 an operating system;
the second calling module is used for calling a custom proxy setting method based on the first hook function;
The storage module is used for storing the positioning management instance and the proxy instance corresponding to the positioning management instance through the user-defined proxy setting method;
the second modification module is used for calling a position proxy method of a proxy instance corresponding to the positioning management instance to carry out position modification based on the self-defined position information;
The method comprises the steps that a positioning management instance is generated through instantiating a positioning management class provided by an operating system, and a proxy instance is generated through setting a proxy for the positioning management instance;
The storage module is used for:
And storing the positioning management instance and the proxy instance corresponding to the positioning management instance into a hash table in the form of a key value pair by the self-defined proxy setting method, wherein the positioning management instance is a key in the key value pair, and the proxy instance is a value in the key value pair.
9. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processing device, implements the steps of the method according to any one of claims 1-7.
10. An electronic device, comprising:
A storage device having a computer program stored thereon;
Processing means for executing said computer program in said storage means to carry out the steps of the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111284865.1A CN113986743B (en) | 2021-11-01 | 2021-11-01 | Location information modification method, device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111284865.1A CN113986743B (en) | 2021-11-01 | 2021-11-01 | Location information modification method, device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113986743A CN113986743A (en) | 2022-01-28 |
CN113986743B true CN113986743B (en) | 2025-02-07 |
Family
ID=79745478
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111284865.1A Active CN113986743B (en) | 2021-11-01 | 2021-11-01 | Location information modification method, device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113986743B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110427323A (en) * | 2019-07-29 | 2019-11-08 | 天津车之家数据信息技术有限公司 | A kind of application testing method, device, proxy server and system |
CN112328419A (en) * | 2020-11-27 | 2021-02-05 | 北京字节跳动网络技术有限公司 | Test case generation method and device for remote procedure call interface, storage medium and electronic equipment |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7665662B2 (en) * | 2005-04-19 | 2010-02-23 | Inveshare, Inc. | Method and system for electronic reporting of institutional votes affecting corporate governance to a plan sponsor |
US10565090B1 (en) * | 2018-01-03 | 2020-02-18 | Amazon Technologies, Inc. | Proxy for debugging transformed code |
EP4070533A1 (en) * | 2020-01-22 | 2022-10-12 | Citrix Systems Inc. | Location-based application discovery |
CN111367791B (en) * | 2020-02-19 | 2023-08-01 | 北京字节跳动网络技术有限公司 | Method, device, medium and electronic equipment for generating test case |
-
2021
- 2021-11-01 CN CN202111284865.1A patent/CN113986743B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110427323A (en) * | 2019-07-29 | 2019-11-08 | 天津车之家数据信息技术有限公司 | A kind of application testing method, device, proxy server and system |
CN112328419A (en) * | 2020-11-27 | 2021-02-05 | 北京字节跳动网络技术有限公司 | Test case generation method and device for remote procedure call interface, storage medium and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN113986743A (en) | 2022-01-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110753089B (en) | Method, device, medium and electronic equipment for managing client | |
CN111679990A (en) | Test data generation method and device, readable medium and electronic equipment | |
CN110851139B (en) | Method and device for checking codes and electronic equipment | |
CN113835992B (en) | Memory leakage processing method and device, electronic equipment and computer storage medium | |
CN113391860B (en) | Service request processing method and device, electronic equipment and computer storage medium | |
CN111400068B (en) | Interface control method and device, readable medium and electronic equipment | |
CN111309304A (en) | Method, device, medium and electronic equipment for generating IDL file | |
CN111240801A (en) | Method, device, medium and electronic equipment for generating heap memory snapshot file | |
CN113157365B (en) | Program running method, program running device, electronic equipment and computer readable medium | |
CN112905220A (en) | Thermal restoration method, device, equipment and storage medium | |
CN113518183B (en) | Camera calling method and device and electronic equipment | |
CN111625326B (en) | Task pipeline execution method and device and electronic equipment | |
CN111949833B (en) | Index construction method, data processing method, device, electronic equipment and medium | |
CN111596992B (en) | Navigation bar display method and device and electronic equipment | |
CN111290812B (en) | Display method, device, terminal and storage medium of application control | |
CN110633324B (en) | Method, apparatus, electronic device and computer readable medium for synchronizing data | |
CN110086880B (en) | Method and apparatus for creating instances of network requests | |
US12417064B2 (en) | Method, apparatus, and electronic device for controlling display | |
CN112286773A (en) | Method, device, medium and electronic equipment for collecting crash information | |
CN113986743B (en) | Location information modification method, device, storage medium and electronic device | |
CN111538717A (en) | Data processing method and device, electronic equipment and computer readable medium | |
CN113138883A (en) | Message processing method and device, storage medium and electronic equipment | |
CN116340014B (en) | Function processing method, device, equipment and storage medium | |
CN114398098B (en) | Application script execution method, device, electronic equipment and computer readable medium | |
CN112346728B (en) | Device adaptation method, apparatus, device and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |