Summary of the invention
The present invention provides a kind of mobile terminal location control method based on Internet of Things, and described method includes following steps:
Whether S1, the backstage that the mobile terminal is detected in the case where the mobile terminal is in screen lock state run acquisition positioning service
One or more application program, if so, S2 is thened follow the steps, if it is not, then return step S1;
S2, the positioning service API of application program described in the acquisition for mobile terminal, and the application program is automatically closed;It is described
Mobile terminal calling system positioning service plug-in unit records the real-time position information that the positioning service plug-in unit obtains;
S3, detects whether the mobile terminal unlocks, if it is, automatically turning on the application program, and will be described in record
Real-time position information is sent to the application program by the positioning service API;If it is not, then return step S2.
As a preferred embodiment, further include:
Detection obtains the quantity of the application program of positioning service, if an only application program, applies journey to be described
The positioning service of the open mobile terminal of sequence;If there is multiple application programs, S2 is thened follow the steps.
As a preferred embodiment, the backstage of the mobile terminal whether run obtain one of positioning service or
The multiple application programs of person, specifically include:
If the application program that the running background of the mobile terminal obtains positioning service have it is multiple, to application described in each
Program sends location frequency solicited message, and the application program is after receiving the location frequency solicited message to the movement
Terminal restoring to normal position frequency information;
The mobile terminal stores and compares the corresponding location frequency information of each described application program, by highest positioning frequency
Rate records the real time position that the positioning service plug-in unit obtains according to the system location frequency and believes as system location frequency
Breath.
As a preferred embodiment, described pass through the positioning service for the real-time position information of record
API is sent to the application program, specifically includes:
The system location frequency is converted to the corresponding location frequency of each described application program by the mobile terminal,
The real-time position information of the mobile terminal is sent to correspondence by the positioning service API according to the location frequency
The application program.
As a preferred embodiment, institute using highest location frequency as system location frequency, according to the system
System location frequency records the real-time position information that the positioning service plug-in unit obtains, further includes:
The remaining capacity of the mobile terminal is detected in the state of the lock screen, if the remaining capacity is lower than the preset first low electricity
Threshold value is measured, then using the high location frequency of location frequency second in the application program as system location frequency, according to the system
System location frequency records the real-time position information that the positioning service plug-in unit obtains;
The real-time position information of the mobile terminal is led to according to the system location frequency after the mobile terminal unlock
It crosses the positioning service API and is sent to second height of location frequency and the highest application program of location frequency;By the system
Location frequency is converted to the corresponding location frequency of other applications, according to the location frequency by the mobile terminal
The real-time position information is sent to the corresponding application program by the positioning service API.
As a preferred embodiment, institute using highest location frequency as system location frequency, according to the system
System location frequency records the real-time position information that the positioning service plug-in unit obtains, further includes:
The remaining capacity of the mobile terminal is detected in the state of the lock screen, if the remaining capacity is lower than the preset second low electricity
Threshold value is measured, then using the low location frequency of location frequency in the application program the as system location frequency, according to the system
Location frequency records the real-time position information that the positioning service plug-in unit obtains;The second low battery threshold value is less than described first
Low battery threshold value;
The real-time position information of the mobile terminal is led to according to the system location frequency after the mobile terminal unlock
It crosses the positioning service API and is sent to all application programs.
As a preferred embodiment, further include:
The mobile terminal pre-establishes the communication connection with second terminal, and the second terminal is capable of providing positioning service;
Whether the backstage that the mobile terminal is detected in the case where the mobile terminal is in screen lock state, which runs, obtains positioning service
Application program, if it is, detecting whether the mobile terminal and the variation of the relative position of the second terminal are more than default
Relative position threshold value, if it exceeds the relative position threshold value, then do not enable the positioning service of the second terminal;If not
More than the relative position threshold value, then the positioning service of the second terminal is enabled, and closes the positioning clothes of the mobile terminal
Business.
As a preferred embodiment, described be less than the relative position threshold value, then the second terminal is enabled
Positioning service, and close the positioning service of the mobile terminal, further includes:
Detect whether the mobile terminal unlocks, if it is, the mobile terminal sends the movement to the second terminal
The inquiry request of the real-time position information of terminal screen locking period, the second terminal will be described after receiving the inquiry request
Real-time position information of the second terminal in the screen locking period is sent to the mobile terminal;The mobile terminal automatically turns on
The application program, and the real-time position information of the screen locking period is sent to described answer by the positioning service API
Use program.
As a preferred embodiment, the mobile terminal automatically turns on the application program, and by the screen locking
The real-time position information of period is sent to the application program by the positioning service API, further includes:
The mobile terminal calibrates the real-time position information of the screen locking period depending on that relative position;
The mobile terminal automatically turns on the application program, and by the real-time position information of the screen locking period after calibration
The application program is sent to by the positioning service API.
The present invention is for one or more application program of mobile terminal running background under commuting scene to cause to move
The problem of terminal power wastes, provides a kind of mobile terminal location control method based on Internet of Things, the mobile terminal location control
The positioning service plug-in unit that method processed only opens mobile terminal bottom under mobile terminal screen locking state is positioned in real time, and is closed
It closes in mobile terminal and obtains the application program of positioning service;And then such is restarted automatically after unlocking the mobile terminal using journey
Sequence, and the real-time position information of the screen locking period is sent to such application program;As it can be seen that method of the invention is not only effective
The electric energy of mobile terminal in the state of the lock screen has been saved, while not having influenced user to the usage experience of application program positioning service.
In addition, for location frequency different needed for mobile terminal different electricity and application program, provided with different power saving plans
Slightly, to further improve the service efficiency of battery capacity of mobile terminal, the usage experience of user is improved.
Embodiment one:
As shown in Figure 1, the present invention provides a kind of mobile terminal location control method based on Internet of Things, the method includes as follows
Step:
Whether S1, the backstage that the mobile terminal is detected in the case where the mobile terminal is in screen lock state run acquisition positioning service
One or more application program, if so, S2 is thened follow the steps, if it is not, then return step S1;It should be noted that
Illustratively, the application program of the positioning service is map class application program, running record class application program, calling a taxi services class
Application program etc., herein with no restrictions;Position control method of the invention is realized in the state of the lock screen, this is because moving
Under the unlocked state of dynamic terminal user tends to the battery level information for effectively obtaining mobile terminal, and then active save
Electric control, therefore the customized power saving strategy of system is not needed, it will affect user just in addition, being controlled in the unlocked state also
It is often used;In summary consider, position control method of the invention is realized in the state of the lock screen.
S2, the positioning service API of application program described in the acquisition for mobile terminal, and the application program is automatically closed;
The mobile terminal calling system positioning service plug-in unit records the real-time position information that the positioning service plug-in unit obtains;It needs
Illustrate, the positioning service API of the application program is the location information that application program obtains mobile terminal operating system
Interface;And the positioning service API of application program described in the acquisition for mobile terminal is in order to mark the API, to move end
The location information at end is sent to corresponding application program by the API.The system location services plug-in unit of the mobile terminal is to move
Dynamic terminal obtains the bottom plug-in unit of system location information, since the positioning service plug-in unit is that operating system itself is included,
Its location efficiency is higher, more saving electric energy;Record the real-time position information that the positioning service plug-in unit obtains, the real time position
What the application software initiation that information can be positioning service demand enabled after requesting, it is preferred that the real-time position information is in institute
State the real-time position information after request enables in mobile terminal screen locking period record.
S3, detects whether the mobile terminal unlocks, if it is, automatically turn on the application program, and by record
The real-time position information is sent to the application program by the positioning service API;If it is not, then return step S2.It needs
It is noted that in order to not influence user to the normal use of mobile terminal and its application program, it is described mobile whole detecting
After the unlock of end, the application program of the positioning service of aforementioned closing is automatically turned on, to maintain the normal use of user;And it will screen
The real-time position information of curtain locking time section is sent to the application program by the positioning service API, can maintain
Normal use of the user to application program.
As it can be seen that the mobile terminal location control method provided by the invention based on Internet of Things, mobile terminal location control
The positioning service plug-in unit that method only opens mobile terminal bottom under mobile terminal screen locking state is positioned in real time, and is closed
The application program of positioning service is obtained in mobile terminal;And then such is restarted automatically after unlocking the mobile terminal using journey
Sequence, and the real-time position information of the screen locking period is sent to such application program;As it can be seen that method of the invention is not only effective
The electric energy of mobile terminal in the state of the lock screen has been saved, while not having influenced user to the usage experience of application program positioning service.
As a preferred embodiment, further include:
Detection obtains the quantity of the application program of positioning service, if an only application program, applies journey to be described
The positioning service of the open mobile terminal of sequence;If there is multiple application programs, S2 is thened follow the steps.It should be noted that such as
The application program that fruit obtains positioning service only has one, since the electricity of its consumption is relative to multiple such positioning services
It is less for application program, it at this point it is possible to not close the application program, and then is directly the open movement of the application program
The positioning service of terminal maintains the normal operation of the application program.
As a preferred embodiment, the backstage of the mobile terminal whether run obtain one of positioning service or
The multiple application programs of person, specifically include:
If the application program that the running background of the mobile terminal obtains positioning service have it is multiple, to application described in each
Program sends location frequency solicited message, and the application program is after receiving the location frequency solicited message to the movement
Terminal restoring to normal position frequency information;It should be noted that since location frequency of the different application programs to positioning service has not
Same demand, therefore, it is necessary to obtain the location frequency of each location services application program, to guarantee that application program can be tieed up
Hold the accuracy requirement of positioning;At this point, each location services application program, which is located frequency needs, is sent to the movement eventually
The system location services plug-in unit at end, so that suitable location frequency is arranged in the system location services plug-in unit accordingly.
The mobile terminal stores and compares the corresponding location frequency information of each described application program, will be highest fixed
Bit frequency records the real time position that the positioning service plug-in unit obtains as system location frequency, according to the system location frequency
Information.It should be noted that selecting highest location frequency in the location frequency of application program in present embodiment, it is ensured that
Each application program can get the location frequency for positioning accuracy demand of being in order, to maintain normally making for user
With experience.At this point, since mobile terminal is in screen lock state and positioning service class application program all has been off, only
It is positioned in real time according only to the positioning service plug-in unit of mobile terminal bottom, both ensure that positioning accuracy in this way, in turn avoid weight
The problem of electricity caused by polyphony location service function wastes.
As a preferred embodiment, described pass through the positioning service for the real-time position information of record
API is sent to the application program, specifically includes:
The system location frequency is converted to the corresponding location frequency of each described application program by the mobile terminal,
The real-time position information of the mobile terminal is sent to correspondence by the positioning service API according to the location frequency
The application program.It should be noted that highest location frequency can satisfy the need of the application program of all location requirements
It asks, but in order to reduce application data processing load, the system location frequency is converted to each by the mobile terminal
The corresponding location frequency of the application program, that is, carry out the conversion of positioning accuracy, to be adapted to different application programs pair
The demand of positioning accuracy.The real-time position information of the mobile terminal is taken by the positioning according to the location frequency
Business API is sent to the corresponding application program, that is, the location frequency for being sent to application program is that the application program feeds back to shifting
The location frequency of dynamic terminal.
As a preferred embodiment, institute using highest location frequency as system location frequency, according to the system
System location frequency records the real-time position information that the positioning service plug-in unit obtains, further includes:
The remaining capacity of the mobile terminal is detected in the state of the lock screen, if the remaining capacity is lower than the preset first low electricity
Threshold value is measured, then using the high location frequency of location frequency second in the application program as system location frequency, according to the system
System location frequency records the real-time position information that the positioning service plug-in unit obtains;It should be noted that first low battery
Threshold value is 30%;In the embodiment, since the remaining capacity of mobile terminal has influenced the normal use of user, and it is higher
Location frequency consumption electric energy it is faster, therefore, it is necessary to reduce location frequency to reduce the speed of mobile terminal electric quantity consumption,
To reduce the experience used user;Preferably, the present invention positioning frequency that location frequency second in the application program is high
Rate is as system location frequency;Further, it is also possible to high, the 4th high location frequency by location frequency third in the application program
As system location frequency, herein with no restrictions.
The real time position of the mobile terminal is believed according to the system location frequency after the mobile terminal unlock
Breath is sent to second height of location frequency and the highest application program of location frequency by the positioning service API;It will be described
System location frequency is converted to the corresponding location frequency of other applications, will be described mobile whole according to the location frequency
The real-time position information at end is sent to the corresponding application program by the positioning service API.It should be noted that
By the above-mentioned setting of the embodiment, location frequency is no longer satisfied normal higher than the application program of the location frequency
It uses, is only capable of for the location information of collected location frequency being sent at this time and is higher than and being answered equal to what the location frequency needed
With program, although the normal use of these application programs influenced at this time, reduces mobile terminal electric quantity consumption speed.This
Outside, since the location frequency is still higher than lower than the application program of the location frequency demand, at this time by collected positioning
Location information after frequency down is sent to corresponding application program, these application programs that will not influence at this time normally make
With.
As a preferred embodiment, institute using highest location frequency as system location frequency, according to the system
System location frequency records the real-time position information that the positioning service plug-in unit obtains, further includes:
The remaining capacity of the mobile terminal is detected in the state of the lock screen, if the remaining capacity is lower than the preset second low electricity
Threshold value is measured, then using the minimum location frequency of location frequency in the application program as system location frequency, according to the system
Location frequency records the real-time position information that the positioning service plug-in unit obtains;The second low battery threshold value is less than described first
Low battery threshold value;It should be noted that illustrative, the second low battery threshold value is 10%, at this point, due to mobile terminal
Electricity is merely capable of maintaining the booting operation of the mobile terminal of a period of time, therefore, the priority of the frequency needs of positioning service
The normal operation of system should be lower than, at this point, the minimum location frequency of location frequency in the application program is determined as system
Bit frequency can maintain the positioning service of application program, together although being unable to satisfy the positioning accuracy demand of most application programs
When also saved to greatest extent positioning service consumption electric energy.
The real time position of the mobile terminal is believed according to the system location frequency after the mobile terminal unlock
Breath is sent to all application programs by the positioning service API.It should be noted that at this point, most due to location frequency
Low, positioning accuracy is also minimum, then without carry out the conversion of location frequency directly the real-time position information is sent to it is all described
Application program, although the normal use of these application programs influenced at this time, reduces mobile terminal electric quantity consumption speed.
As a preferred embodiment, further include:
The mobile terminal pre-establishes the communication connection with second terminal, and the second terminal is capable of providing positioning service;It needs
It is noted that preferred, the second terminal is smartwatch, can also be that other are capable of providing the portable of positioning service
Equipment, herein with no restrictions.Preferably, the real-time position information is stored by Internet of Things server.
Whether the backstage that the mobile terminal is detected in the case where the mobile terminal is in screen lock state runs acquisition positioning clothes
The application program of business, if it is, detect the mobile terminal and the relative position of the second terminal variation whether be more than
Preset relative position threshold value, if it exceeds the relative position threshold value, then do not enable the positioning service of the second terminal;Such as
Fruit is less than the relative position threshold value, then enables the positioning service of the second terminal, and closes determining for the mobile terminal
Position service.It should be noted that the relative position threshold value is 3 meters, if the phase of the mobile terminal and the second terminal
Position is maintained within 3 meters of relative position threshold value, then shows to be in " colleague " state, i.e., two in two terminals of the period
Terminal is carried by same user, or two to be gone together user carries;At this point, being closed to save the electric energy of mobile terminal
The positioning service of the mobile terminal;And since second terminal is usually that smartwatch etc. provides the equipment of simple services,
Its energy consumption is relatively lower, enables the positioning service of the second terminal at this time, to be that the mobile terminal mentions by the second terminal
For positioning service., whereas if the relative position of the mobile terminal and the second terminal does not maintain relative position threshold
Within 3 meters of value, then show that two terminals are not on " colleague " state in the period, at this time the positioning clothes of the mobile terminal
Business can not be replaced by more energy-efficient equipment, it is therefore desirable to the positioning service for maintaining the mobile terminal, without enabling described the
The positioning service of two terminals.
As a preferred embodiment, described be less than the relative position threshold value, then the second terminal is enabled
Positioning service, and close the positioning service of the mobile terminal, further includes:
Detect whether the mobile terminal unlocks, if it is, the mobile terminal sends the movement to the second terminal
The inquiry request of the real-time position information of terminal screen locking period, the second terminal will be described after receiving the inquiry request
Real-time position information of the second terminal in the screen locking period is sent to the mobile terminal;The mobile terminal automatically turns on
The application program, and the real-time position information of the screen locking period is sent to described answer by the positioning service API
Use program.It should be noted that after mobile terminal unlock, in order to maintain the usage experience of user, it is desirable to provide positioning
The application program of service obtains location information, at this time, it may be necessary to which the mobile terminal sends the movement eventually to the second terminal
The inquiry request of the real-time position information of screen locking period is held, the inquiry request is based on, the second terminal is by described second
Real-time position information of the terminal in the screen locking period is sent to the mobile terminal, for the application journey of the positioning service
Sequence uses.
As a preferred embodiment, the mobile terminal automatically turns on the application program, and by the screen locking
The real-time position information of period is sent to the application program by the positioning service API, further includes:
The mobile terminal calibrates the real-time position information of the screen locking period depending on that relative position;It needs to illustrate
It is that since the relative position is real-time change, and the mobile terminal is due to being not turned in the intermediary time period of screen locking
Positioning service, location information can not be collected;At this point, in order to increase the accuracy of the position information of mobile terminal, it is excellent
Choosing, can by acquire the mobile terminal and the second terminal the start time point of the screen locking period and at the end of
Between the average value of relative distance at both points two time points being switched on positioning service carry out above-mentioned calibration operation.Alternatively,
The time point of equal time distances opens the positioning service of the mobile terminal within the screen locking period, and collecting
The relative position information both calculated after the location information of mobile terminal is stated, closes the mobile terminal after completing the calculating
Positioning service;And then calibration operation is carried out to the relative position according to the average value of all acquisition times.
The mobile terminal automatically turns on the application program, and by the real time position of the screen locking period after calibration
Information is sent to the application program by the positioning service API.It should be noted that it is illustrative, by the institute of calibration
Stating relative position between mobile terminal and the second terminal is 2 meters, then by the screen locking period with described second eventually
End is sent to the application program by the positioning service API at a distance of 2 meters of real-time position information.
The present invention is for one or more application program of mobile terminal running background under commuting scene to cause to move
The problem of terminal power wastes, provides a kind of mobile terminal location control method based on Internet of Things, the mobile terminal location control
The positioning service plug-in unit that method processed only opens mobile terminal bottom under mobile terminal screen locking state is positioned in real time, and is closed
It closes in mobile terminal and obtains the application program of positioning service;And then such is restarted automatically after unlocking the mobile terminal using journey
Sequence, and the real-time position information of the screen locking period is sent to such application program;As it can be seen that method of the invention is not only effective
The electric energy of mobile terminal in the state of the lock screen has been saved, while not having influenced user to the usage experience of application program positioning service.
In addition, for location frequency different needed for mobile terminal different electricity and application program, provided with different power saving plans
Slightly, to further improve the service efficiency of battery capacity of mobile terminal, the usage experience of user is improved.
Those skilled in the art of the present technique be appreciated that can be realized with computer program instructions these structure charts and/or
The combination of each frame and these structure charts and/or the frame in block diagram and/or flow graph in block diagram and/or flow graph.It can be by this
The processor that a little computer program instructions are supplied to general purpose computer, special purpose computer or other programmable data processing methods comes
Machine is generated, is used for be performed instruction by the processor of computer or other programmable data processing methods and create
Realize the method specified in the frame or multiple frames of structure chart and/or block diagram and/or flow graph.
Those skilled in the art of the present technique have been appreciated that in the present invention the various operations crossed by discussion, method, in process
Steps, measures, and schemes can be replaced, changed, combined or be deleted.Further, each with having been crossed by discussion in the present invention
Kind of operation, method, other steps, measures, and schemes in process may also be alternated, changed, rearranged, decomposed, combined or deleted.
Further, in the prior art to have and the step in various operations, method disclosed in the present invention, process, measure, scheme
It may also be alternated, changed, rearranged, decomposed, combined or deleted.
The above description is only an embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.