Geofencing generation methods, usage methods, equipment, media and program products

By generating geofences based on base station data, the problems of high power consumption and privacy violations caused by frequent location positioning of terminal devices are solved, enabling accurate push services while protecting user privacy.

CN120343493BActive Publication Date: 2026-06-30HONOR DEVICE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-01-10
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Frequent acquisition of location information from terminal devices consumes a lot of power, and location information is a matter of user privacy, thus infringing on user privacy.

Method used

Geofencing is generated based on base station data. By obtaining data from the base stations connected to the terminal device, the corresponding geofence is determined, and relevant operations are pushed, reducing the frequent retrieval of location information.

Benefits of technology

It reduces power consumption caused by frequent location positioning and enables precise delivery of services corresponding to geofences to users, thus protecting user privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120343493B_ABST
    Figure CN120343493B_ABST
Patent Text Reader

Abstract

This application relates to the field of electronic information technology, and discloses a method for generating, using, device for, medium for, and program products for geofencing. The geofencing generation method of this application generates geofencing corresponding to each service based on base station data accessed by the user when using various services. During the process of a user using a terminal device to access a target service, base station data connected to the terminal device can be obtained, and the geofencing can be determined based on the obtained base station data. If the user subsequently connects to the base station corresponding to the geofencing during the use of the terminal device, the relevant operations of the target service corresponding to that geofencing will be triggered. Therefore, it is not necessary to frequently retrieve the location information of the terminal device; the geofencing corresponding to the terminal device can be determined based on the base station currently connected to the terminal device, and the relevant operations of the geofencing can be pushed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic information technology, and in particular to a method for generating a geofence, a method for using it, an apparatus, a medium, and a program product. Background Technology

[0002] Geo-fencing is a technology for location-based services (LBS) that uses a virtual fence to define a virtual geographic boundary. When a terminal device is detected entering, leaving, or moving within a specific geographic area, the corresponding geofencing-related actions are triggered or deactivated.

[0003] Currently, different geofences can be created based on different service needs. Thus, when the location of a user matches a geofence based on the user's location information, such as the device's latitude and longitude coordinates, the user is considered to have entered or left that geofence. This can then trigger related actions, such as recommending services corresponding to the geofence. However, frequently obtaining the device's location information consumes a significant amount of power, and the device's precise location information is considered user privacy information, thus infringing on user privacy. Summary of the Invention

[0004] To avoid frequently obtaining the location information of terminal devices, this application provides a method for generating geofences, a method for using geofences, a device, a medium, and a program product.

[0005] In a first aspect, embodiments of this application provide a method for generating a geofence. The method includes: acquiring base station data related to a target service executed by a terminal device in a first region, wherein the base station data includes the location information of the terminal device when connecting to at least one base station in the first region and executing the target service; determining the coverage area of ​​each base station in the first region based on the base station data; and generating a geofence for the target service corresponding to the terminal device based on the coverage area of ​​each base station in the first region, wherein the geofence includes at least one base station in the first region that meets the coverage conditions.

[0006] It is understood that the first area can be the target area in this application embodiment, and the target service can be any service that uses location function, such as map service, subway station access service, express delivery station access service, high-speed rail station access service, and airport access service, etc. The base station data can be the crowdsourced data in this application embodiment, and the base station data includes latitude and longitude information, base station information (cellid), city code, location area code (LAC), etc.

[0007] In this embodiment, a geofence is generated based on base station data, thus eliminating the need to frequently retrieve the location information of the terminal device. Alternatively, the geofence corresponding to the terminal device can be determined based on the base station currently connected to the terminal device, and related operations can be pushed to the geofence. This achieves accurate delivery of services corresponding to the geofence to the user and reduces the power consumption caused by frequent use of location services.

[0008] In one possible implementation, the coverage conditions include: the base station center of the base station is in the first area, and the proportion of the base station's coverage area in the first area is greater than a first threshold.

[0009] It is understandable that the first threshold can be any real number between 0 and 1, such as 0.5.

[0010] In one possible implementation, a geofence for the target service corresponding to the terminal device is generated based on the coverage of each base station in the first region, including: determining the base stations in the first region that meet the coverage conditions based on the coverage of each base station in the first region and the center of the base station; and generating a geofence for the target service corresponding to the terminal device based on the base stations in the first region that meet the coverage conditions.

[0011] For example, such as Figure 6b As shown, the target area T of service T includes base stations 1, 2, 3, 4, 5, 6, 7, 8, and 9. The centers of base stations 1, 2, 3, 4, 5, 6, 7, and 8 are determined to be within the target area T, and the proportion of their coverage area within the target area T is greater than a first threshold, such as 0.5. The center of base station 9 is not within the target area T, and the proportion of its coverage area within the target area T is less than the first threshold, such as 0.5. Therefore, a geofence for service T is generated based on base stations 1, 2, 3, 4, 5, 6, 7, and 8.

[0012] In one possible implementation, at least one base station includes a first base station; and based on base station data, the coverage area of ​​each base station in the first region is determined, including: clustering multiple locations represented by each base station data based on location information in multiple base station data of the first base station to obtain at least one first clustering region; repeating the following operations until the number of first clustering regions is 1: deleting base station data corresponding to locations not located within the LAC region of the first base station from the locations represented by each base station data in at least one first clustering region; and clustering the remaining base station data after deletion to obtain at least one first clustering region of the first base station.

[0013] It is understood that the first clustering region can be an effective cluster in the embodiments of this application.

[0014] It's understandable that LAC (Location Area Code) is an identifier of a base station's area characteristics. The coverage area of ​​an LAC is an irregular polygon, and a more accurate description of the actual area is needed using specific polygon details. Figure 1 As shown, Figure 1 A schematic diagram of two LACs is shown.

[0015] In one possible implementation, the method for determining the LAC area of ​​the first base station includes: aggregating the LACs included in the first region according to the administrative regions of the city to obtain the LAC area of ​​the first base station.

[0016] In one possible implementation, the method for determining whether base station data is located within the LAC area of ​​the first base station includes: drawing a ray from each base station data of the first base station; determining that the base station data is located within the LAC area of ​​the first base station if the number of intersections between the ray and the LAC area of ​​the first base station is odd; and determining that the base station data is not located within the LAC area of ​​the first base station if the number of intersections between the ray and the LAC area of ​​the first base station is even.

[0017] For example, such as Figure 10b As shown, a ray is drawn from the point data A. If the intersection of point data A and the polygon is determined to be 1, then point data A is determined to be inside the polygon, and the base station corresponding to point data A is a base station within the LAC.

[0018] In one possible implementation, based on the location information in the data from multiple base stations of the first base station, multiple locations represented by the data from each base station are clustered to obtain at least one first clustering region. This includes: based on a clustering algorithm and the location information in the data from multiple base stations of the first base station, multiple locations represented by the data from each base station are clustered to obtain at least one first clustering region; wherein the clustering algorithm includes at least one of the following: density-based spatial clustering of applications with noise (DBSCAN) algorithm, k-means clustering algorithm (K-means), and hierarchical clustering algorithm.

[0019] In one possible implementation, determining the coverage area of ​​each base station in the first region based on base station data further includes: generating a first coverage area of ​​the first base station based on a first clustering region.

[0020] In one possible implementation, generating a first coverage area of ​​a first base station based on a first cluster region includes: fitting the first cluster region of the first base station to obtain a first coverage area of ​​a preset shape.

[0021] In one possible implementation, fitting the first cluster region of the first base station to obtain a first coverage region of a preset shape includes: fitting the first cluster region to obtain a first coverage region of a preset shape using a fitting algorithm; wherein the fitting algorithm includes at least one of algebraic approximation method, least squares method, and orthogonal distance regression method.

[0022] In one possible implementation, the preset shape includes at least one of the following: circle, rectangle, rhombus, polygon.

[0023] In one possible implementation, the center point of the first base station is the point in the first cluster region of the first base station that has the highest location density corresponding to the base station data and the most times it is connected to the base station.

[0024] In one possible implementation, based on a clustering algorithm and location information in the data from multiple base stations of the first base station, multiple locations represented by the data from each base station are clustered to obtain at least one first clustering region. This includes: based on the administrative region of the city and the location information in the data from multiple base stations of the first base station, the data from multiple base stations of the first base station are bucketed to obtain bucketed data; and based on the cell and the clustering algorithm, multiple locations represented by the bucketed data are clustered to obtain at least one first clustering region.

[0025] In one possible implementation, before determining the coverage area of ​​each base station in the first region based on base station data, data in the base station data that does not meet the compliance conditions is deleted; the compliance conditions include: the city code of the base station data meets the first interval corresponding to the city code, the cellid of the base station data meets the second interval corresponding to the cellid, the LAC area of ​​the base station data meets the third interval corresponding to the LAC area, and the latitude and longitude of the base station data meets the fourth interval corresponding to the latitude and longitude.

[0026] Secondly, embodiments of this application provide a method for using a geofence, characterized in that it includes: detecting that the terminal device is connected to a first base station during the movement of the terminal device; and the terminal device performing an operation corresponding to the geofence to which the first base station belongs.

[0027] In one possible implementation, the operation corresponding to the geofence includes at least one of triggering a recommendation service, triggering a notification service, and triggering a registration service.

[0028] For example, if the target service is a card swiping service for entering and exiting a subway station, the relevant action that triggers the geofencing is to pop up the QR code for boarding.

[0029] Thirdly, embodiments of this application provide a terminal device, including: a memory for storing instructions executed by one or more processors of the terminal device, and a processor, which is one of the one or more processors of the terminal device, for implementing any of the geofence generation methods provided by the first aspect and various possible implementations of the first aspect, and any of the geofence usage methods provided by the second aspect and various possible implementations of the second aspect.

[0030] Fourthly, embodiments of this application provide a readable medium storing instructions that, when executed on an electronic device, cause the electronic device to implement any of the geofence generation methods provided by the first aspect and various possible implementations of the first aspect, as well as any of the geofence usage methods provided by the second aspect and various possible implementations of the second aspect.

[0031] Fifthly, embodiments of this application provide a computer program product, which includes computer instructions. When executed by an electronic device, the electronic device performs any of the geofence generation methods provided by the first aspect and various possible implementations of the first aspect, as well as any of the geofence usage methods provided by the second aspect and various possible implementations of the second aspect. Attached Figure Description

[0032] Figure 1 According to an embodiment of this application, a schematic diagram of a polygon corresponding to an LAC region is shown;

[0033] Figure 2 According to an embodiment of this application, a schematic diagram of a geofencing application scenario is shown;

[0034] Figure 3 According to an embodiment of this application, a flowchart illustrating a method for using a geofence is shown;

[0035] Figure 4a According to an embodiment of this application, a schematic diagram of a scenario including multiple base stations in region A is shown;

[0036] Figure 4b According to an embodiment of this application, a schematic diagram of dotted data included in region A is shown;

[0037] Figure 4c According to an embodiment of this application, a schematic diagram of the base station coverage area L1 within region A is shown;

[0038] Figure 4d According to an embodiment of this application, a schematic diagram of a geofence A1 is shown;

[0039] Figure 5aAccording to an embodiment of this application, a schematic diagram of a geofence B1 is shown;

[0040] Figure 5b According to an embodiment of this application, a schematic diagram of a geofence B1' is shown;

[0041] Figure 6a According to an embodiment of this application, a flowchart illustrating a method for generating geofences is shown;

[0042] Figure 6b According to an embodiment of this application, a schematic diagram of a method for generating geofences is shown.

[0043] Figure 7 According to an embodiment of this application, a flowchart of a method for determining base station coverage is shown;

[0044] Figure 8 According to an embodiment of this application, a schematic diagram of the distribution of dotted data is shown;

[0045] Figure 9 According to an embodiment of this application, a schematic diagram of multiple effective clusters is shown;

[0046] Figure 10a According to an embodiment of this application, a schematic diagram of a polygon corresponding to another LAC region is shown;

[0047] Figure 10b According to an embodiment of this application, a scene diagram is shown for determining whether the dotted data is within the polygon corresponding to the LAC region;

[0048] Figure 11 According to an embodiment of this application, a schematic diagram of the base station coverage area L1 within a target area is shown;

[0049] Figure 12 According to an embodiment of this application, a schematic diagram of the coverage area of ​​base station C1, base station C2 and base station C3 is shown;

[0050] Figure 13 According to some embodiments of this application, a schematic diagram of the structure of an electronic device 10 is shown. Detailed Implementation

[0051] The illustrative embodiments of this application include, but are not limited to, a method for generating a geofence, a method for using it, an apparatus, a medium, and a program product.

[0052] The technical terms used in this application will be explained below.

[0053] Network positioning technology refers to the technology of determining the location information of a terminal device by utilizing the different signal strengths at different locations in space. The signal can specifically be a Wi-Fi signal, Bluetooth signal, etc. Network positioning technology first needs to collect the signal and location coordinates at various locations based on the distribution of signal strength values, establishing a mapping relationship between signals and location coordinates, i.e., constructing a fingerprint database. This fingerprint database can be deployed on a network server. Then, when a terminal device, such as a mobile phone, receives signal data (such as a Wi-Fi fingerprint scanned by the phone or a Bluetooth fingerprint connected to the phone), it can send the signal data to the network server. The network server can then obtain the location information of the terminal device based on the fingerprint database and return it to the terminal device.

[0054] It is understood that in some embodiments, the fingerprint database includes a Wi-Fi fingerprint database, a Bluetooth fingerprint database, etc.

[0055] Crowdsourced data refers to location information obtained by numerous terminal devices when a specific service with location functionality is enabled. This location information can also be called location tracking data, such as latitude and longitude information, base station information (cellid), city code, and location area code (LAC).

[0056] Specific services refer to those that utilize the positioning function of the terminal device during its use, such as map services, services for entering and exiting subway stations, express delivery stations, high-speed rail stations, and airports. Specifically, map services include navigation; subway station services include scanning QR codes or swiping cards to enter / exit; express delivery station services include scanning QR codes to send / receive packages; high-speed rail station services include scanning QR codes for ticket checking; and airport services include scanning QR codes for ticket checking.

[0057] Cell ID: Each base station has a unique cell ID that identifies it. Therefore, by obtaining the cell ID, the base station corresponding to the terminal device can be determined.

[0058] LAC: To determine the location of mobile stations, the coverage area of ​​each Global System for Mobile Communications (GSM) public land mobile network (PLMN) is divided into many location areas, and LACs are used to identify these different location areas. LACs are divided according to regions and have certain geographical boundaries, but the regions of LACs do not completely coincide with administrative regions.

[0059] It is understandable that each base station has a unique cellid and LAC.

[0060] In some embodiments, a globally unique base station may be identified using a mobile country code (MCC), a mobile network code (MNC), a LAC, and a cellid.

[0061] It's understandable that LAC (Location Area Code) is an identifier of a base station's area characteristics. The coverage area of ​​an LAC is an irregular polygon, and a more accurate description of the actual area is needed using specific polygon details. Figure 1 As shown, Figure 1 Two schematic diagrams of LACs are shown. It can be understood that the square and circular representations of the LAC boundaries will differ from the actual area of ​​the LAC.

[0062] A geofence is a virtual boundary defined by a virtual fence. When a user arrives near a specific geographic location, their mobile phone can determine the geofence based on its location information (such as the detected latitude and longitude coordinates) and then recommend services corresponding to that geofence to the user.

[0063] The following is combined Figure 2 This section introduces the triggering scenarios for geofencing.

[0064] For example, Figure 2 The geofence shown is 1 for subway station A1 and 2 for cinema A2. When user A enters geofence 1, a ride code card pops up on user A's phone 100, allowing the user to board the subway without manually opening the corresponding app. When user A moves from geofence 1 to geofence 2, a ticket collection reminder pops up on user A's phone 100 to remind the user of the ticket collection time and prevent the user from missing the movie start.

[0065] See Figure 3 , Figure 3 A flowchart illustrating a geofence triggering scenario is shown, applied to electronic devices. The specific process is as follows:

[0066] 301: Obtain the location information of the terminal device.

[0067] In this embodiment of the application, the electronic device can obtain the location information of the terminal device, such as the latitude and longitude coordinates of the mobile phone, through network positioning technology.

[0068] 302: Determine a geofence that matches the location information of the terminal device.

[0069] For example, if the location information of the terminal device determines that the terminal device is within the coordinate data range of geofence 1, then the terminal device is determined to match geofence 1. If the location information of the terminal device determines that the terminal device is within the coordinate data range of geofence 2, then the terminal device is determined to match geofence 2.

[0070] 303: Geofencing triggered.

[0071] It is understood that triggering a geofence can recommend relevant operations to the user by the terminal device, such as recommending services corresponding to the geofence, or it can execute relevant operations by the terminal device, such as executing services corresponding to the geofence. This application embodiment uses the example of triggering a geofence to recommend geofence services to the user by the terminal device for illustration.

[0072] For example, such as Figure 2 As shown, if mobile phone 100 matches geofence 1, geofence 1 is triggered, and mobile phone 100 can display a ride code card on the user interface, allowing users to board the bus without manually opening the corresponding application. If mobile phone 100 matches geofence 2, geofence 2 is triggered, and mobile phone 100 can pop up a ticket collection reminder on the user interface to remind the user of the ticket collection time and prevent the user from missing the movie start. If mobile phone 100 matches geofence 3 of a courier station, geofence 3 is triggered, and mobile phone 100 can pop up a package pickup reminder on the user interface to remind the user to pick up the package on time.

[0073] As can be seen from the above introduction, the process of determining the geofence that matches the terminal device needs to continuously obtain the terminal device's location information, which consumes a lot of power. Furthermore, the terminal device's location information includes the user's privacy information, which inadvertently infringes on the user's privacy.

[0074] It's understandable that users continuously access the network while using their terminal devices. Therefore, the terminal devices constantly go through a cycle of connecting to and disconnecting from communication base stations. However, during network deployment, the location and coverage area of ​​base stations remain fixed for a period of time.

[0075] Therefore, to solve the above problems, this application provides a method for generating geofences. This method generates geofences corresponding to each service based on base station data accessed by the user when using various services. During the user's use of a terminal device to access a target service, base station data connected to the terminal device can be obtained, and a geofence can be determined based on this data. If the user subsequently connects to the base station corresponding to the geofence during their use of the terminal device, the relevant operation for the target service corresponding to that geofence will be triggered. For example, if the target service is a card-swiping service for entering and exiting a subway station, the relevant operation triggered by the geofence will be the pop-up of a QR code for transportation. Thus, without frequently retrieving the terminal device's location information, the geofence corresponding to the terminal device can be determined based on the base station currently connected to the terminal device, and the relevant operation for the geofence can be pushed to the user. This achieves accurate delivery of services corresponding to geofences to the user and reduces the power consumption caused by frequent location usage.

[0076] It is understood that, in some embodiments, geofences for each service can be generated based on base station data in the following ways:

[0077] 1) Obtain crowdsourced data in the target area. The crowdsourced data includes the data generated when users connect to the base station while using the target service, such as latitude and longitude information, cellid, city code, LAC, etc.

[0078] 2) Based on the data points of each base station in the target area, determine the base station center and coverage area of ​​each base station. The base station center is the central location identified by latitude and longitude information when the terminal device connects to the base station to perform the target service; that is, the location with the densest data points and the most frequent base station connections. In this embodiment, the data points of each base station can be fitted to obtain a fitted circle representing the coverage area of ​​each base station.

[0079] 3) Merge the coverage of each base station in the target area to obtain the geofence of the target service in the target area.

[0080] For example, such as Figure 4a As shown, when a user in region A uses target service S1, the base stations they access include base stations B1 to B5. The coverage area of ​​each base station can be determined by obtaining the location data of each base station within region A, and a geofence for the corresponding target service S1 can be generated based on the coverage area of ​​each base station.

[0081] For example, such as Figure 4b As shown, Figure 4bEach circle in the diagram represents the location of a user when using target service S1 and connecting to base station B1 in area A. The center point P, where user locations are relatively concentrated (i.e., the point with the highest data density), is determined as the center point of base station B1. The coverage radius R1 can be determined based on the base station type of base station B1. Using point P as the center and R1 as the coverage radius, a diagram is generated as follows: Figure 4c The coverage area L1 of base station B1 is shown. The method for determining the signal coverage area from base station B2 to base station B5 is the same as the method for determining the signal coverage area of ​​base station B1, and will not be repeated here.

[0082] Based on the signal coverage areas of the base stations included in Service A, such as base station B1 to base station B5, generate as follows: Figure 4d The geofence A1 for service A is shown. Thus, when a user uses a terminal device, if it is determined that the base station connected to the terminal device is within the coverage area of ​​any base station in geofence A1, such as base station B1, then service A is triggered.

[0083] In some embodiments, to improve the accuracy of the determined base station center, the crowdsourced data can be filtered and clustered to narrow down the scope of the crowdsourced data. Specifically, this includes: deleting illegal data from the crowdsourced data, where illegal data refers to data whose latitude and longitude information, cellid, city code, or LAC exceeds a reasonable range; deleting data from the crowdsourced data that is not within the corresponding LAC area; and deleting data from the crowdsourced data with location drift.

[0084] In this embodiment of the application, the crowdsourcing data is clustered, including using a density-based spatial clustering of applications with noise (DBSCAN) method to cluster the crowdsourcing data.

[0085] It is understandable that when users are near highways, subways, and expressways, the signal is unstable, resulting in location drift data. This means that the crowdsourced data from base stations near highways, subways, and expressways will have significant errors along the route, causing the same base station to have different coverage areas.

[0086] In order to avoid the problem of different base station coverage areas for the same base station, this application embodiment cleans the data by using a box plot with adaptive parameters to filter out data with location drift. By performing secondary clustering on the crowdsourced data, only one effective cluster is left for each base station, thus avoiding the problem of the base station coverage radius being too large, and obtaining crowdsourced data that can reproduce the base station coverage area.

[0087] The following is combined Figure 5a and Figure 5bA comparison is made between geofence B1 obtained without using the geofence generation method provided in this application and geofence B1' obtained using the geofence generation method provided in this application.

[0088] like Figure 5a As shown, in geofence B1 obtained without using the geofence generation method provided in this application, the same base station has multiple coverage areas. For example, cellid5 has two coverage areas; cellid8 also has two coverage areas, and one coverage area is inside geofence B1, while the other coverage area is outside geofence B1.

[0089] When user A moves to location A1 within the coverage area of ​​cellid3, it is determined that user A is within geofence B1, and the service corresponding to geofence B1 is triggered. When user B moves to location B1 within the coverage area of ​​cellid3, it is determined that user B is within geofence B1, and the service corresponding to geofence B1 is triggered.

[0090] However, if user B moves to position C of cellid8 outside geofence B1, since another cellid8 belongs to geofence B1, it will also be considered that user B is inside geofence B1, triggering the service corresponding to geofence B1. But at this time, user B is not inside geofence B1, that is, the service corresponding to geofence is mistakenly triggered.

[0091] like Figure 5b As shown, in the geofence B1' obtained using the geofence generation method provided in this application, each base station has only one coverage area, and the coverage area of ​​the base station is determined based on crowdsourced data after filtering and aggregation. The coverage area of ​​the base station is more accurate, and the accuracy of the obtained geofence B1' is also higher, avoiding the situation of erroneously triggering the service corresponding to the geofence.

[0092] In this embodiment, the device for acquiring crowdsourced data from the base station and generating geofences can be electronic device 10, while the device for acquiring the base station connected to the terminal device, determining the corresponding geofence, and the target service can specifically be electronic device 20. Specifically, the electronic device can be a mobile phone, smartwatch, television, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. The electronic device can also be a physical server or cloud device, such as an x86 server, ARM server, etc., or a virtual machine (VM) implemented based on a general-purpose physical server combined with network functions virtualization (NFV) technology. A virtual machine refers to a complete computer system simulated by software, possessing complete hardware system functions and running in a completely isolated environment. This application does not impose any restrictions on the specific type of the electronic device.

[0093] Alternatively, electronic device 10 and electronic device 20 may be the same device.

[0094] The terminal device can be a device with positioning function, such as, but not limited to, mobile phones, smartwatches, televisions, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. The embodiments of the present invention do not impose any restrictions on the specific type of terminal device.

[0095] The method for generating a geofence according to embodiments of this application will be described in detail below. This method for generating a geofence is applied to an electronic device 10. Figure 6a The diagram illustrates a method for generating a geofence according to an embodiment of this application. The method for generating a geofence includes:

[0096] 601: Retrieve crowdsourced data from the target region.

[0097] It is understandable that crowdsourced data includes data points generated when a user's terminal device connects to a base station while using the target service, including the user's latitude and longitude information, the cell ID of the connected base station, the city code, LAC, etc.

[0098] The target service can be any service that uses location functionality, such as map services, services for entering and exiting subway stations, services for entering and exiting express delivery stations, services for entering and exiting high-speed rail stations, and services for entering and exiting airports, etc.

[0099] Optionally, to improve the accuracy of crowdsourced data, invalid data can be cleaned. For example, unreasonable data points, such as latitude and longitude coordinates, neighborhood numbers, and other illegal information that exceeds reasonable ranges, can be deleted.

[0100] It is understood that the city code, cell ID, LAC, and latitude and longitude of each city are standardized within a certain range. In this embodiment of the application, unreasonable data in the crowdsourced data, such as city codes, cell IDs, LACs, and latitude and longitudes that exceed reasonable ranges, can be deleted, thereby selecting data that is beneficial for learning the location and coverage of cellular network base stations.

[0101] For example, determine the city code range, cellid range, LAC range, and latitude / longitude range corresponding to the crowdsourced data, and delete the crowdsourced data that does not meet the city code range, cellid range, LAC range, and latitude / longitude range.

[0102] 602: Determine the coverage area of ​​each base station based on the data points in the crowdsourced data corresponding to each base station.

[0103] In this embodiment of the application, the effective clusters in the crowdsourced data corresponding to each base station can be determined by clustering the data points in the crowdsourced data corresponding to each base station. Then, the center point of the location with the highest data point density and the most base station connections in the effective cluster is determined as the base station center. The data points of each base station are fitted to obtain a fitted circle representing the coverage area of ​​each base station.

[0104] In this embodiment, a fitting algorithm can be used to fit the point data of each base station to obtain a fitted circle representing the coverage area of ​​each base station. The fitting algorithm includes at least one of algebraic approximation, least squares, and orthogonal distance regression.

[0105] Alternatively, clustering can be performed using a clustering algorithm, which can be any one of DBSCAN, K-means, or hierarchical clustering.

[0106] In this embodiment of the application, in order to ensure the efficiency of the clustering algorithm, the crowdsourcing data can also be divided according to the administrative regions of the cities, thereby obtaining crowdsourcing data corresponding to different cities.

[0107] 603: Merge the coverage areas of each base station in the target area to obtain the geofence of the service in the target area.

[0108] In this embodiment of the application, the base stations included in service S1 in the target area can be determined. Then, based on the base station center and coverage area of ​​each base station determined in step 602, the coverage area of ​​each base station is fitted to obtain the geofence of service S1 in the target area, such that the geofence of service S1 includes the coverage area of ​​each base station included in service S1. It can be understood that the base station center represents the location of the base station.

[0109] For example, such as Figure 4d As shown, the geofence A1 of service S1 includes the coverage area of ​​each of the base stations B1, B2, B3 and B4 included in service S1.

[0110] In this embodiment of the application, base stations in the target area that meet the coverage conditions can be determined based on the coverage range and center of each base station in the target area; and a geofence for the target service can be generated based on the base stations in the target area that meet the coverage conditions.

[0111] The coverage conditions include the base station center being within the first area, and the coverage area of ​​the base station being greater than a first threshold within the first area. It can be understood that the first threshold can be any real number between 0 and 1, for example, 0.5.

[0112] For example, such as Figure 6b As shown, the target area T of service T includes base stations 1, 2, 3, 4, 5, 6, 7, 8, and 9. The centers of base stations 1, 2, 3, 4, 5, 6, 7, and 8 are determined to be within the target area T, and the proportion of their coverage area within the target area T is greater than a first threshold, such as 0.5. The center of base station 9 is not within the target area T, and the proportion of its coverage area within the target area T is less than the first threshold, such as 0.5. Therefore, a geofence for service T is generated based on base stations 1, 2, 3, 4, 5, 6, 7, and 8.

[0113] If the terminal device is detected to be connected to base station 4 during its movement, the terminal device will execute the operation corresponding to the geofence to which base station 4 belongs. The geofence-related operation includes at least one of the following: triggering a recommendation service, triggering a notification service, and triggering a registration service.

[0114] In this way, when a user uses the terminal device, electronic device 10 or electronic device 20 only needs to obtain the base station to which the terminal device is connected to to determine the geofence corresponding to the base station, and thus determine the geofence corresponding to the terminal device. This triggers the relevant operations for the service corresponding to the geofence on the terminal device. For example, if the target service is a card swiping service for entering and exiting a subway station, the relevant operation triggered by the geofence is to pop up the QR code for transportation.

[0115] Therefore, without frequently retrieving the location information of the terminal device, the geofence corresponding to the terminal device can be determined based on the base station currently connected to the terminal device, and relevant geofence-related operations can be pushed to the user. This achieves accurate push of geofence-related services to the user and reduces the power consumption caused by frequent use of location services.

[0116] The following is combined Figure 7 Examples of the implementation of steps 601-602 above in other embodiments are provided below. Figure 7 The method for determining the coverage area of ​​the base station shown can be applied to electronic device 10, including:

[0117] 701: Crowdsourced data.

[0118] In this embodiment of the application, the electronic device 10 can obtain the terminal user's location information (latitude and longitude information), the LAC, cellid, and city code of the accessed base station when the terminal user uses the positioning function of the terminal device in the target area.

[0119] For example, such as Figure 8 As shown, this illustrates the location tracking data of a terminal user connected to the same base station when using the positioning function of their terminal device within a target area. Figure 8 The distribution of dots on the terminal devices is represented by circles.

[0120] 702: Invalid value data cleaning.

[0121] In order to improve the accuracy of the obtained crowdsourced data and reduce the scope of data processing, in this embodiment of the application, invalid value data in the crowdsourced data can be cleaned to delete unreasonable data points in the crowdsourced data, such as latitude and longitude, community number and other illegal information that exceeds the reasonable range.

[0122] It is understandable that the city code, cellid, LAC, and latitude and longitude of each region have reasonable ranges within a certain area. For example, the city code range for region A is [123, 125], the cellid range is [12345, 19999], the LAC range is [22345, 29999], the longitude range is [114.054935, 115.054935], and the latitude range is [22.57692, 23.57692]. In some embodiments, the corresponding city code range, cellid range, and LAC range can be determined based on the latitude and longitude of each region.

[0123] In this embodiment of the application, unreasonable data in the crowdsourced data, such as city codes, cell, LAC, and latitude and longitude data that are outside the reasonable range, can be deleted, thereby selecting data that is beneficial for learning the location and coverage of cellular network base stations.

[0124] For example, determine the city code interval, cellid interval, LAC interval, and latitude and longitude interval of the target area, and delete data in the crowdsourced data that does not meet the city code interval, cellid interval, LAC interval, and latitude and longitude interval.

[0125] 703: Divide into buckets by city and perform DBSCAN clustering by cell.

[0126] In this embodiment of the application, in order to ensure the efficiency of the DBSCAN algorithm, the crowdsourcing data is divided according to the administrative regions of the cities, based on the urban area information, so as to obtain the crowdsourcing data corresponding to different cities; then, based on the DBSCAN algorithm, the crowdsourcing data corresponding to each city is clustered according to the cell, so as to obtain the crowdsourcing data of each cell.

[0127] like Figure 9 As shown, Figure 9 Each circle in the diagram represents Figure 8 The diagram shown is a schematic representation of the dotted data after DBSCAN clustering.

[0128] As we can understand it, binning refers to dividing a row of items or a plane into multiple bins, so that each bin has corresponding internal information. Based on the binning method, crowdsourcing data can be binned according to the administrative regions of cities. This allows the crowdsourcing data to be divided into multiple regions according to the administrative regions of each city, facilitating subsequent DBSCAN clustering of the crowdsourcing data based on these regions. For example, if the crowdsourcing data includes cities A, B, C, and D, it can be binned according to the administrative location of cities A, B, C, and D.

[0129] In some embodiments, the crowdsourced data for each city can be divided into buckets of 2km*2km grid size, with each grid block corresponding to a target area. The grid size includes, but is not limited to, 2km*2km.

[0130] It's understandable that the process of dividing a city into different categories can also be based on road condition information. For example, for areas where main urban roads are located, target areas can be formed by using the main roads as boundaries.

[0131] As can be understood, a cell is a cellular unit, which in a cellular mobile communication system is the area covered by one or a portion of a base station (fan antenna), within which terminal devices can reliably communicate with the base station via a wireless channel.

[0132] Clustering can be understood as the process of dividing a collection of physical or abstract objects into multiple classes composed of similar objects. A cluster generated by clustering is a set of data objects that are similar to objects in the same cluster but different from objects in other clusters.

[0133] In some embodiments, the crowdsourcing data for each city can be clustered by neighborhood using clustering algorithms such as K-means or hierarchical clustering to obtain the crowdsourcing data for each neighborhood.

[0134] 704: There is only one valid cluster.

[0135] After clustering the cells, the clustering quality can be measured and the number of effective clusters can be determined. If there is 1 effective cluster for the same base station, no secondary clustering is required. If there are ≥2 effective clusters for the same base station, secondary clustering of the effective clusters for that base station is required.

[0136] It is understandable that clustering algorithms can divide crowdsourced data based on the similarity or distance between data points. By dividing crowdsourced data through clustering algorithms, each base station can obtain at least one cluster. Data points within the same cluster should be as similar as possible, while data points between different clusters should be as different as possible.

[0137] In this embodiment of the application, the clustering quality can be measured by the silhouette coefficient of the cluster. When the silhouette coefficient of the cluster meets the preset threshold, the cluster is determined to be a valid cluster.

[0138] In some embodiments, the average distance between different clusters obtained by the clustering algorithm and the average distance between data within a cluster can be calculated; when the average distance between different clusters satisfies a first distance and the average distance between data within a cluster satisfies a second distance, the cluster is determined to be a valid cluster.

[0139] 705: Valid clusters ≥ 2.

[0140] It is understood that the base station center of the same base station is unique. When the effective clusters of the same base station are ≥2, multiple base station centers may be obtained based on multiple effective clusters. Therefore, when it is determined that the effective clusters of the same base station are ≥2, step S706 is executed.

[0141] In some embodiments, steps 703-705 can be executed simultaneously with steps 706-707. In some embodiments, steps 706-707 can be executed before steps 703-705. In other embodiments, steps 706-707 can be executed after step 705.

[0142] 706: Aggregate LACs by city dimension.

[0143] In this embodiment, the LACs of each city can be aggregated by administrative region using a clustering algorithm, taking urban area information as the dimension. This determines the polygons corresponding to the LACs of each city's administrative region, and the point data not within the LACs can be filtered out using these polygons. The clustering algorithm can be any one of DBSCAN, K-means, or hierarchical clustering.

[0144] It's understandable that a LAC (Location Area Code) is an identifier of a base station's regional characteristics. Neither square nor circular representations can accurately mark the boundaries between two LACs, leading to errors. Describing the coverage area of ​​an LAC using a specific polygonal shape more accurately reflects the actual area. Figure 1 As shown, Figure 1 The diagram shows two LACs. The polygons corresponding to the LACs can be used later to correct cellid mislearning, that is, to filter out the point data that is not in the LAC.

[0145] 707: Draw the polygon corresponding to LAC.

[0146] In this embodiment of the application, the distribution of LAC can be used to learn, such as Figure 10a The distribution of Thiessen polygons in the LAC is shown. If the data point is inside the Thiessen polygon of the corresponding LAC, then the data point can be used for learning the base station location. If the data point is outside the Thiessen polygon of the corresponding LAC, then the data point cannot be used for learning the base station location. Specifically, to determine whether it is inside, please refer to the description of step 708.

[0147] Thiessen polygons, also known as Voronoi diagrams, are a set of continuous polygons formed by the perpendicular bisectors of line segments connecting two adjacent points. The distance from any point within a Thiessen polygon to the control points constituting that polygon is less than its distance to the control points of other polygons. Thiessen polygons are a type of spatial plane partitioning characterized by the fact that any location within a polygon is closest to a sample point (such as a settlement) of that polygon and farthest from sample points in adjacent polygons, and each polygon contains exactly one sample point.

[0148] In some embodiments, shapes such as circles, rectangles, and rhombuses can also be learned through the distribution of LAC.

[0149] 708: Perform a second clustering, selecting the cluster with the largest number of clusters, and checking if the corresponding LAC is within its polygonal range. If it is, it is a valid cell coverage cluster.

[0150] It is understandable that the crowdsourced data may contain the same cellid with data points in two cities (city A and city B). If the base station center is learned by city, the same base station coverage will be learned in both cities. However, in reality, it is highly likely that only one city has signal coverage of that base station.

[0151] In this embodiment of the application, after executing step S705, if it is determined that there are ≥2 effective clusters after the first clustering, a second clustering can be performed based on the latitude and longitude of the cluster centers after the first clustering using a clustering algorithm, and the central cluster of the second clustering is determined based on the coverage of the LAC determined in step 707.

[0152] In this embodiment of the application, the method for determining whether the marker data is within the polygon of the corresponding LAC includes: drawing a ray, such as a horizontal ray, from any marker data, determining the number of intersections between the ray and the polygon; if the number of intersections is odd, then the marker data is determined to be within the polygon, that is, the marker data constitutes a valid cell coverage cluster, that is, the base station corresponding to the marker data is a base station within the LAC; if the number of intersections is even, then the marker data is determined to be outside the polygon, that is, the base station corresponding to the marker data is a base station outside the LAC.

[0153] For example, such as Figure 10b As shown, a ray is drawn from the point data A. If the intersection of point data A and the polygon is determined to be 1, then point data A is determined to be inside the polygon, and the base station corresponding to point data A is a base station within the LAC.

[0154] It is understandable that different clusters with the same LAC and cellid in the same city and different cities can be processed by the methods shown in steps 706 to 708.

[0155] 709: The box plot is further cleaned to filter out data with positioning drift.

[0156] It is understandable that signal instability occurs near highways, subways, and expressways, leading to location drift in the crowdsourced data. This means that the crowdsourced data from base stations near highways, subways, and expressways will contain significant errors along the route. To eliminate these errors, this embodiment uses an adaptive parameter box plot to clean the data after primary or secondary clustering, filtering out location drift data and reproducing crowdsourced data that accurately reflects the base station coverage area.

[0157] A box plot, also known as a box-and-whisker plot, is a statistical graph used to display the distribution of a set of data. Box plots are primarily used to reflect the characteristics of the original data distribution and can also be used to compare the distribution characteristics of multiple sets of data. The parameters of a box plot can be determined by the proportion of crowdsourced data distributed from the center of the effective cluster.

[0158] In some embodiments, if the base station corresponding to the effective cluster is a 4G base station, the upper and lower boundaries of the box plot are the first distance; if the base station corresponding to the effective cluster is a 5G base station, the upper and lower boundaries of the box plot are the second distance; and if the base station corresponding to the effective cluster is a 6G base station, the upper and lower boundaries of the box plot are the third distance. The first distance can be 800m, the second distance can be 600m, and the third distance can be 400m.

[0159] It's understandable that 4G primarily uses frequency bands between 700MHz and 2.6GHz, while 5G transmits at higher frequency bands, including 3.5GHz, 26GHz, and 28GHz. The signal transmission characteristics of higher frequency bands result in a relatively shorter transmission distance for 5G signals and poorer penetration through buildings, thus limiting 5G coverage compared to 4G.

[0160] In this embodiment of the application, the cluster data retained after data cleaning and clustering by adaptive parameter box plot data is filtered out to remove data with location drift and data that cannot be clustered, so as to ensure that the filtered data is more consistent with the actual situation.

[0161] Crowdsourced data reveals that the data points for base stations corresponding to the same cell ID may be concentrated in one area, or they may be concentrated in several areas. Figure 9 As shown, the same base station has multiple densely packed data points in close proximity. These data are analyzed using primary and secondary clustering methods. Figure 9 By cleaning the data shown, the area with the densest data (the coverage area of ​​the base station) can be learned.

[0162] 710: After filtering, perform density clustering and select the center point of the highest density cluster as the cell center.

[0163] In this embodiment of the application, the center point with the highest data density and the most connections to the base station in the effective cluster of each base station can be selected as the cell center (base station center).

[0164] In some embodiments, the center point with the highest location density and the most connections to base stations in the effective cluster of each base station can be selected as the cell center.

[0165] In this embodiment of the application, the crowdsourced data after box plot cleaning can be clustered again using a clustering algorithm to improve the accuracy of the center points of the highest density clusters obtained by clustering.

[0166] like Figure 11 As shown, Figure 11 Point P in the middle is Figure 11 The dotted data shown corresponds to the cell center of the base station.

[0167] It is understandable that after the second clustering of the selected points, each base station has a unique valid cluster.

[0168] In some embodiments, the following operations may be repeated until each base station has a unique valid cluster: delete the base station data corresponding to the location that is not located in the LAC area of ​​the corresponding base station from the location represented by the base station data of each base station; cluster the remaining base station data after deletion to obtain the valid cluster of each base station.

[0169] 711: The coverage area can be represented by a fitted circle or an outer polygon.

[0170] In this embodiment of the application, the data points of each base station obtained by clustering in step 710 can be fitted to obtain a fitted circle for each base station. The fitted circle is obtained by finding the optimal circle parameters given a set of data points, so that the circle best fits these data points.

[0171] In this embodiment, a fitting algorithm can be used to fit the point data of each base station to obtain a fitted circle representing the coverage area of ​​each base station. The fitting algorithm includes at least one of algebraic approximation, least squares, and orthogonal distance regression.

[0172] 712: Base station location and signal coverage area, LAC coverage polygon.

[0173] In the embodiments of this application, the location and LAC of the base station learned based on the embodiments of this application are shown in Table 1 and Table 2.

[0174] Table 1 Results after cellid learning

[0175] Citycode Opt LAC Cellid Longtitude Latitude Radius 755 move 90452 12345 114.054935 22.57692 436 755 move 90452 3698 114.054415 22.57603 200 755 move 90452 7715 114.054302 22.57667 362 755 move 361 3647 114.05385 22.57107 179

[0176] Where Citycode is the city code, Opt is the operator, Longtitude is the longitude, Latitude is the latitude, and Radius is the base station radius.

[0177] Table 2 Results after LAC learning

[0178]

[0179] Where Citycode is the city code, Opt is the operator, and Polygon is the shape of the polygon corresponding to LAC.

[0180] For example, such as Figure 12 As shown, C11 is the coverage area of ​​base station C1 obtained without using the base station coverage area determination method provided in this application, and C12 is the coverage area of ​​base station C1 determined by the method provided in the embodiments of this application; C21 is the coverage area of ​​base station C2 obtained without using the base station coverage area determination method provided in this application, and C22 is the coverage area of ​​base station C2 determined by the method provided in the embodiments of this application; C31 is the coverage area of ​​base station C3 obtained without using the base station coverage area determination method provided in this application, and C32 is the coverage area of ​​base station C3 determined by the method provided in the embodiments of this application.

[0181] It can be observed that the coverage area of ​​the base station learned through the embodiments of this application is more concentrated.

[0182] In this application embodiment, the parameters used to establish the geofence can be determined based on the service bound to the geofence. For example, some services require accurate recommendations to users, which in turn requires the geofence to be highly accurate. Therefore, a geofence established solely based on a city cannot meet the high-precision requirements. However, the method for determining the base station coverage provided in this application embodiment can improve the accuracy of the geofence and the accuracy of the detection results.

[0183] The method for determining the base station coverage area provided in this application can be applied not only to the generation of geofences with different precision and services, such as obtaining the base station distribution at the current location through specific points of interest (POIs) to quickly generate geofences (geofences composed of base stations), and the method for determining the base station coverage area provided in this application can also realize network positioning based on cellular networks according to the base station access situation, and can also be used for network handover judgment, such as assisting soft handover of the network when the current network coverage edge is known, or when the current network model strength is weak.

[0184] The hardware structure of each electronic device mentioned in this application will be described below using electronic device 10 as an example. Figure 13 As shown, the electronic device 10 may include a processor 110, a power module 140, a memory 180, a mobile communication module 130, a wireless communication module 120, a sensor module 190, an audio module 150, a camera 170, an interface module 160, buttons 101, and a display screen 102, etc.

[0185] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 10. In other embodiments of this application, the electronic device 10 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0186] Processor 110 may include one or more processing units, such as processing modules or circuits of a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP), microprocessor (MCU), artificial intelligence (AI) processor, or field-programmable gate array (FPGA). Different processing units may be independent devices or integrated within one or more processors. Processor 110 may include storage units for storing instructions and data. In some embodiments, the storage unit in processor 110 is a cache memory 180.

[0187] It is understood that the geofence generation method in this embodiment can be executed by the processor 110 of the corresponding electronic device. The power module 140 may include a power supply, a power management component, etc. The power supply may be a battery. The power management component is used to manage the charging of the power supply and the power supply to other modules.

[0188] The mobile communication module 130 may include, but is not limited to, antennas, power amplifiers, filters, and low-noise amplifiers (LNAs). The mobile communication module 130 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the electronic device 10. The mobile communication module 130 can receive electromagnetic waves via the antenna, filter and amplify the received electromagnetic waves, and then transmit them to a modem processor for demodulation. The mobile communication module 130 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna. In some embodiments, at least some functional modules of the mobile communication module 130 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 130 and at least some modules of the processor 110 may be housed in the same device.

[0189] The wireless communication module 120 may include an antenna, which enables the transmission and reception of electromagnetic waves. The wireless communication module 120 can provide solutions for wireless communication applications on the electronic device 10, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The electronic device 10 can communicate with networks and other devices through wireless communication technologies.

[0190] In this embodiment of the application, the base station connected to the terminal device 30 can be obtained through the wireless communication module 120 or the mobile communication module 130.

[0191] In some embodiments, the mobile communication module 130 and the wireless communication module 120 of the electronic device 10 may also be located in the same module.

[0192] The display screen 102 is used to display human-computer interaction interfaces, images, videos, etc. The display screen 102 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a quantum dot light-emitting diode (QLED), etc.

[0193] The sensor module 190 may include proximity sensors, pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.

[0194] Audio module 150 is used to convert digital audio information into analog audio signal output, or to convert analog audio input into digital audio signal. Audio module 150 can also be used for encoding and decoding audio signals. In some embodiments, audio module 150 may be located in processor 110, or some functional modules of audio module 150 may be located in processor 110. In some embodiments, audio module 150 may include a speaker, earpiece, microphone, and headphone jack. Camera 170 is used to capture still images or videos. An object generates an optical image through the lens and projects it onto a photosensitive element. The photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to image signal processing (ISP) to convert it into a digital image signal. Electronic device 10 can implement shooting functions through ISP, camera 170, video codec, graphics processing unit (GPU), display screen 102, and application processor, etc.

[0195] Interface module 160 includes an external storage interface, a USB interface, and a subscriber identification module (SIM) card interface. The external storage interface can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the electronic device 10. The external storage card communicates with the processor 110 through the external storage interface to perform data storage. The universal serial bus interface is used for communication between the electronic device 10 and other electronic devices. The subscriber identification module card interface is used to communicate with the SIM card installed in the electronic device 10, for example, to read or write phone numbers stored in the SIM card.

[0196] In some embodiments, the electronic device 10 further includes buttons 101, a motor, and indicators. The buttons 101 may include volume buttons, a power button, etc. The motor is used to generate a vibration effect in the electronic device 10, for example, vibrating when the user's electronic device 10 is called to prompt the user to answer the call. The indicators may include laser indicators, radio frequency indicators, LED indicators, etc.

[0197] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0198] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0199] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0200] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, compact disc-read-only memory (CD-ROMs), magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0201] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0202] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0203] It should be noted that in the examples and description of this patent, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. Although this application has been illustrated and described with reference to certain preferred embodiments, those skilled in the art will understand that various changes in form and detail may be made without departing from the spirit and scope of this application.

Claims

1. A method for generating geofences, characterized in that, The method for generating the geofence includes: Obtain base station data related to a target service executed by a terminal device in a first region, wherein the base station data includes the location information of the terminal device when it connects to at least one base station in the first region and when it executes the target service; Based on the base station data, the coverage area of ​​each base station in the first region is determined; Based on the coverage of each base station in the first region, a geofence corresponding to the target service of the terminal device is generated, wherein the geofence includes at least one base station in the first region that meets the coverage conditions; The at least one base station includes a first base station; and Determining the coverage area of ​​each base station in the first region based on the base station data includes: Based on the location information in the data from multiple base stations of the first base station, the multiple locations represented by the data from each base station are clustered to obtain at least one first clustering region. Repeat the following operations until the number of the first cluster regions is 1: Delete the base station data corresponding to the positions that are not located within the LAC region of the first base station in the positions represented by the base station data in at least one first cluster region; Cluster the remaining base station data after deletion to obtain at least one first clustering region for the first base station; And generate the first coverage area of ​​the first base station based on one of the first clustering regions.

2. The method for generating geofences according to claim 1, characterized in that, The coverage conditions include: The base station center is located within the first area, and the proportion of the base station's coverage area within the first area is greater than a first threshold.

3. The method for generating a geofence according to claim 2, characterized in that, The step of generating a geofence for the target service corresponding to the terminal device based on the coverage area of ​​each base station in the first region includes: Based on the coverage area and center of each base station in the first region, determine the base stations in the first region that meet the coverage conditions; Based on the base stations in the first region that meet the coverage conditions, a geofence corresponding to the target service of the terminal device is generated.

4. The method for generating a geofence according to claim 1, characterized in that, The method for determining the LAC region of the first base station includes: Based on the city's administrative regions, the LACs included in the first region are aggregated to obtain the LAC region of the first base station.

5. The method for generating a geofence according to claim 1, characterized in that, A method for determining whether the base station data is located within the LAC area of ​​the first base station includes: Draw a ray from each base station data of the first base station; If the number of intersections between the ray and the LAC region of the first base station is odd, it is determined that the base station data is located within the LAC region of the first base station. If the number of intersections between the ray and the LAC region of the first base station is even, it is determined that the base station data is not located within the LAC region of the first base station.

6. The method for generating a geofence according to claim 1, characterized in that, The step of clustering multiple locations represented by each base station data based on location information from multiple base station data of the first base station to obtain at least one first clustering region includes: Based on the clustering algorithm and the location information in the data of multiple base stations of the first base station, the multiple locations represented by the data of each base station are clustered to obtain at least one first clustering region. The clustering algorithm includes at least one of the following: DBSCAN algorithm, K-means algorithm, and hierarchical clustering algorithm.

7. The method for generating a geofence according to claim 1, characterized in that, The process of generating the first coverage area of ​​the first base station based on the first clustering region includes: The first cluster region of the first base station is fitted to obtain a first coverage area with a preset shape.

8. The method for generating a geofence according to claim 7, characterized in that, The step of fitting the first clustering region of the first base station to obtain a first coverage region of a preset shape includes: The first clustering region is fitted using a fitting algorithm to obtain a first coverage region of a preset shape; The fitting algorithm includes at least one of algebraic approximation, least squares, and orthogonal distance regression.

9. The method for generating a geofence according to claim 8, characterized in that, The preset shape includes at least one of the following: circle, rectangle, rhombus, polygon.

10. The method for generating a geofence according to claim 1, characterized in that, The center point of the first base station is the point in the first cluster region of the first base station that has the highest location density corresponding to the base station data and the most times it is connected to the base station.

11. The method for generating a geofence according to claim 6, characterized in that, The method, based on a clustering algorithm and location information from multiple base station data of the first base station, clusters multiple locations represented by each base station data to obtain at least one first clustering region, including: Based on the city's administrative regions and the location information in the data from multiple base stations of the first base station, the data from multiple base stations of the first base station is divided into buckets to obtain bucketed data. Based on the cell and the clustering algorithm, multiple locations represented by the bucketed data are clustered to obtain at least one first clustering region.

12. The method for generating a geofence according to claim 1, characterized in that, include: Before determining the coverage area of ​​each base station in the first region based on the base station data, delete data in the base station data that does not meet the compliance conditions; The compliance requirements include: The city code of the base station data satisfies the first interval corresponding to the city code, the cellid of the base station data satisfies the second interval corresponding to the cellid, the LAC area of ​​the base station data satisfies the third interval corresponding to the LAC area, and the latitude and longitude of the base station data satisfies the fourth interval corresponding to the latitude and longitude.

13. A method of using a geofence, characterized in that, include: During the movement of the terminal device, it was detected that the terminal device was connected to the first base station; The terminal device performs the operation corresponding to the geofence to which the first base station belongs, wherein the geofence is obtained based on the geofence generation method according to any one of claims 1 to 12.

14. The method of using a geofence according to claim 13, characterized in that, The operations corresponding to geofencing include: Trigger at least one of the following: recommendation service, notification service, and registration service.

15. A terminal device, characterized in that, include: A memory for storing instructions executed by one or more processors of the terminal device, and the processor being one of the one or more processors of the terminal device for performing the geofence generation method of any one of claims 1 to 12 or the geofence usage method of any one of claims 13 to 14.

16. A readable medium, characterized in that, The readable medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the geofence generation method of any one of claims 1 to 12 or the geofence usage method of any one of claims 13 to 14.

17. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by an electronic device, enable the electronic device to perform a geofence generation method as described in any one of claims 1 to 12 or a geofence usage method as described in any one of claims 13 to 14.