A method, device and storage medium for generating a unique device identification code
By obtaining user device information in the Android system and generating a unique identification code in the database, the problem of stability and uniqueness of device identification code generation is solved, and accurate identification of user equipment is achieved, which is suitable for the field of Internet technology.
Patent Information
- Application Number
- CN201911081537.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-07
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-11-07
AI Technical Summary
In the Android system, the existing method of generating unique device identification codes has stability and uniqueness issues. For example, the MAC address is disabled, IMEI number acquisition is subject to permission restrictions, ANDROID_ID will change, serial number acquisition has limitations, and UniquePsuedoID may be repeated. The user device cannot be accurately identified.
By obtaining the basic information, software version, hardware information and user setting information of the user device, search for matching information in the database or calculate similarity to generate a unique identification code, and send it to the user device to ensure the reliability and uniqueness of the identification code. .
It achieves stable and unique identification code generation for user equipment, avoids dependence on local storage, improves the reliability and uniqueness of the identification code, and is suitable for the field of Internet technology.
Smart Images

Figure CN112784318B
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a method, apparatus and storage medium for generating a unique identification code for a device. Background Art
[0002] In the Internet field, business operations based on the device identification code of the user's device are the prerequisite for ensuring business security. Therefore, it is particularly important to generate a stable, reliable and unique device identification code. Currently, the Android system provides a method for generating a unique device identification code, but due to limitations such as the Android system version and bugs in the manufacturer's customized system, the stability and uniqueness are not ideal. Other hardware information identifications also have problems to varying degrees due to limitations such as the system version and mobile phone hardware. Generally, there are several ways to generate a unique device identification code in an Android device:
[0003] 1. Wireless network card Media Access Control Address (MAC) address: Mac refers to the unique identification code of the device network card. This code is unique in the world and is generally called the physical address. The hardware address is used to define the location of the device.
[0004] 2. International Mobile Equipment Identity (IMEI) is also called Device Id. Currently, GSM (Global System for Mobile Communications) / W-CDMA (Wideband Code Division Multiple Access) / LTE (Long Term Evolution) mobile terminals need to use IMEI numbers. In a single-card project, one mobile phone number corresponds to one IMEI number, while a dual-card mobile phone will correspond to two IMEI numbers, one for each mobile phone card.
[0005] 3. ANDROID_ID: When the device is run for the first time, the system will randomly generate a 64-bit number and save this value in hexadecimal. This hexadecimal number is ANDROID_ID, but this value will change if the phone is restored to factory settings.
[0006] 4. Serial Number: Starting from Android 2.3, a serial number can be obtained through the android.os.Build.SERIAL method.
[0007] 5.UniquePsuedoID: Assemble the obtained device hardware information, such as manufacturer, model, and resolution.
[0008] However, the above-listed methods all have certain defects and cannot guarantee the accurate identification of the device identification code of a certain user device. Among them, the shortcomings of each method are as follows:
[0009] 1. MAC address of wireless network card: After Android 6.0, when obtaining the MAC address, the Android operating system interface will return the default MAC address of "02:00:00:00:00:00". This is because Google officially disabled the getSystemService(Context.WIFI_SERVICE) method to obtain the MAC address in order to strengthen permission management.
[0010] 2. IMEI number (DeviceId): If the user disables calling, the acquisition fails, and the user is prompted to grant the calling permission in product design, which will affect the user experience;
[0011] 3. ANDROID_ID:
[0012] a. This value will change after the phone is restored to factory settings;
[0013] b. In the domestic Android customization environment, some devices will not return ANDROID_ID.
[0014] 4. Serial Number: No permission is required to obtain the serial number, but there are certain limitations. Garbage data will appear on some mobile phones. For example, the Redmi phone returns continuous non-random numbers.
[0015] 5. UniquePsuedoID: Since it is directly related to the device information, if the devices are from the same batch, the generated content may be the same. Therefore, if this method is used alone, it cannot be used to generate a unique identifier. Summary of the invention
[0016] The embodiment of the present application provides a method for generating a unique device identification code, which overcomes the problem of being unable to generate a stable and reliable unique identification code for a user device.
[0017] The method includes:
[0018] Acquire first device information of a user device;
[0019] Based on the first device information, searching in a database whether there is second device information matching the first device information, and if the second device information is not found, generating a unique identification code corresponding to the user device according to the first device information;
[0020] The unique identification code is sent to the user device corresponding to the first device information.
[0021] Optionally, according to the basic device information, the device software version information, the device hardware information and the user setting information included in the first device information, searching in the data whether there is the second device information that matches the basic device information, the device software version information, the device hardware information and the user setting information one by one;
[0022] When the second device information is not found, the similarity between the first device information and the device information stored in the database is calculated, and the stored device information corresponding to the similarity greater than a preset threshold is used as the second device information.
[0023] Optionally, the unique identification code corresponding to the second device information and stored in the database is sent to the user device corresponding to the first device information.
[0024] Optionally, the basic device information, the device software version information, the device hardware information and the user setting information contained in the first device information are compressed to generate a message digest of the first device information, and the message digest is used as the unique identification code of the user device.
[0025] In another embodiment of the present invention, a device for generating a unique device identification code is provided, the device comprising:
[0026] An acquisition module, used to acquire first device information of a user device;
[0027] a search module, configured to search in a database whether there is second device information matching the first device information based on the first device information, and to generate a unique identification code corresponding to the user device according to the first device information if the second device information is not found;
[0028] The first sending module is used to send the unique identification code to the user equipment corresponding to the first device information.
[0029] Optionally, the search module includes:
[0030] a search subunit, configured to search in the data whether there is second device information that matches the basic device information, the device software version information, the device hardware information, and the user setting information contained in the first device information, based on the basic device information, the device software version information, the device hardware information, and the user setting information contained in the first device information;
[0031] The calculation subunit is used to calculate the similarity between the first device information and the stored device information in the database when the second device information is not found, and use the stored device information corresponding to the similarity greater than a preset threshold as the second device information.
[0032] Optionally, the device further comprises:
[0033] The second sending module is used to send the unique identification code corresponding to the second device information and stored in the database to the user equipment corresponding to the first device information.
[0034] Optionally, the search module further includes:
[0035] A generating subunit is used to compress the basic device information, the device software version information, the device hardware information and the user setting information contained in the first device information, generate a message digest of the first device information, and use the message digest as the unique identification code of the user device.
[0036] In another embodiment of the present invention, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to perform each step in the above-mentioned method for generating a unique device identification code.
[0037] In another embodiment of the present invention, a terminal device is provided, comprising a processor, wherein the processor is configured to execute each step in the above method for generating a unique device identification code.
[0038] Based on the above embodiment, firstly, the first device information of the user device is obtained, and then, based on the first device information, the database is searched for the existence of the second device information that matches the first device information, and when the second device information is not found, a unique identification code corresponding to the user device is generated according to the first device information, and finally, the unique identification code is sent to the user device corresponding to the first device information. The embodiment of the present application generates a unique identification code of the user device by obtaining the first device information from the user device, and stores it in the database. When the second device information corresponding to the first device information does not exist in the database, a unique identification code of the user device is generated according to the first device information. The unique identification code of the user device does not rely on local storage, thereby ensuring the reliability and uniqueness of the identification code of the user device. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 A schematic flow chart of a method for generating a unique device identification code provided by embodiment 100 of the present application is shown;
[0041] Figure 2 A schematic diagram showing a specific process of a method for generating a unique device identification code provided by embodiment 200 of the present application;
[0042] Figure 3 A schematic diagram showing that the embodiment 300 of the present application further provides an apparatus for generating a unique device identification code;
[0043] Figure 4 A schematic diagram of a terminal device provided in embodiment 400 of the present application is shown. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the implementation of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0046] Based on the problems in the prior art, an embodiment of the present application provides a method for generating a unique device identification code, which is mainly applicable to the field of Internet technology. Based on the acquired first device information of the user device, a unique identification code of the user device is generated on the server side and stored in the database of the server side, so that the user device can continue to issue the unique identification code when acquiring the identification code next time, thereby ensuring the reliability and uniqueness of the identification code of the user device. The technical scheme of the present invention is described in detail with specific embodiments below to realize a method for generating a unique device identification code. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Figure 1 FIG. 1 is a flow chart of a method for generating a unique device identification code provided by Embodiment 100 of the present application. The detailed steps are as follows:
[0047] S11, obtaining first device information of a user device.
[0048] In this step, the server obtains the first device information of the user device. Specifically, when the user device is installed for the first time or the unique identification code is not cached, the server obtains the first device information from the user device. Here, the first device information is mainly a device description about the user device, and the first device information at least includes but is not limited to basic device information, device software version information, device hardware information and user setting information. Among them, the basic device information includes Device ID (IMEI), pixels, resolution, International Mobile Subscriber Identity (International Mobile Subscriber Identity, IMSI), number of cores, resolution, screen size, etc.; the device software version information includes system version number, kernel version number, Android ID, etc.; the device hardware information includes model, brand, device manufacturer, central processing unit (CPU) architecture, hardware type, system version, motherboard information, memory size, processor frequency, motherboard information, etc.; the user setting information includes language settings, latitude and longitude (location) settings, user language, time zone, location and other information.
[0049] S12, based on the first device information, searching in the database whether there is second device information matching the first device information, and when the second device information is not found, generating a unique identification code corresponding to the user device according to the first device information.
[0050] In this step, after obtaining the first device information of the user device, the database of the user device is searched for whether the second device information matching the first device information has been cached according to the first device information. The second device information is the same as the information represented by the first device information. The information contained in the first device information is matched with the stored device information in the database. When the second device information matching the first device information is not found, the similarity between the first device information and each stored device information is calculated to further search for the existence of the second device information in the database.
[0051] Furthermore, if the second device information is not found in the database, a unique identification code of the user device is generated according to the first device information.
[0052] S13: Send the unique identification code to the user equipment corresponding to the first equipment information.
[0053] In this step, the server sends the generated unique identification code to the user device corresponding to the first device information.
[0054] As described above, based on the above embodiment, firstly, the first device information of the user device is obtained, and secondly, based on the first device information, the database is searched for the existence of the second device information that matches the first device information, and when the second device information is not found, a unique identification code corresponding to the user device is generated according to the first device information, and finally, the unique identification code is sent to the user device corresponding to the first device information. The embodiment of the present application generates a unique identification code of the user device by obtaining the first device information from the user device, and stores it in the database. When the second device information corresponding to the first device information does not exist in the database, a unique identification code of the user device is generated according to the first device information. The unique identification code of the user device does not rely on local storage, thereby ensuring the reliability and uniqueness of the identification code of the user device.
[0055] like Figure 2 As shown, it is a schematic diagram of a specific process of a method for generating a unique device identification code provided by embodiment 200 of the present application. The detailed process of the specific process is as follows:
[0056] S201: Acquire first device information of a user device.
[0057] Here, the server obtains the first device information of the user device when the user device is installed for the first time or the unique identification code is not stored or erased locally on the user device. At this time, the server obtains the first device information of the user device, including basic device information, device software version information, device hardware information, and user setting information. The user device can upload the first device information to the server using the Https protocol.
[0058] S202: Search in a database whether there is second device information that matches the first device information one-to-one.
[0059] Here, according to the basic device information, device software version information, device hardware information and user setting information contained in the first device information, the data is searched for whether there is second device information that matches the basic device information, device software version information, device hardware information and user setting information one by one. Specifically, after obtaining the first device information uploaded by the user device, the server matches the basic device information, device software version information, device hardware information and user setting information contained in the first device information with each item of information contained in the stored device information in the database one by one, and determines the stored device information that matches one by one as the second device information.
[0060] S203: Calculate the similarity between the first device information and the stored device information.
[0061] Here, when the second device information is not found, the similarity between the first device information and the stored device information in the database is calculated, and the stored device information corresponding to the similarity greater than the preset threshold is used as the second device information. Specifically, when the scheme in the above step S202 is performed and the second device information corresponding to the first device information is not found, the server calculates the similarity between the first device information and the stored information through a similarity algorithm. Here, if the user changes the first device information of the user device and the user device already has a unique device code, at this time, the similarity algorithm is used to search the database for stored information with high similarity as the second device information, and the unique device code corresponding to the second device information is obtained, thereby ensuring the uniqueness of the user device. The server calculates the similarity between the first device information and the stored device information through a similarity algorithm such as the SimHash algorithm or the Jaccard algorithm.
[0062] S204: Determine whether the similarity value is greater than a preset threshold.
[0063] Here, when the similarity value is higher than a preset threshold, the stored information can be considered as the second device information corresponding to the first device information. The preset threshold can be set according to an empirical value. Based on the first device information, the similarity is calculated by a similarity algorithm such as the SimHash algorithm or the Jaccard algorithm, and the best matching search result is determined when the similarity value is greater than the preset threshold.
[0064] S205: Use the stored device information corresponding to the similarity greater than the preset threshold as the second device information.
[0065] S206: Generate a unique identification code corresponding to the user equipment according to the first equipment information.
[0066] Here, the basic device information, device software version information, device hardware information and user setting information contained in the first device information are compressed to generate a message digest of the first device information, and the message digest is used as the unique identification code of the user device. It can be generated according to the hash algorithm held by each (such as md5, sha-1, etc.) to ensure the uniqueness of the generated message digest.
[0067] S207: Send the unique identification code to the user equipment corresponding to the first equipment information.
[0068] In this step, the unique identification code corresponding to the second device information and stored in the database is sent to the user device corresponding to the first device information, and a unique identification code corresponding to the user device is generated according to the first device information.
[0069] The present application implements the above-mentioned method of generating a unique device identification code based on the above-mentioned steps. By obtaining a data set consisting of the first device information of the user device. Furthermore, in the database of the server, a similarity algorithm such as SimHash or Jaccard is used or a match is performed to find out whether the unique device code corresponding to the user device has been generated and cached. If the match is successful, it means that the second device information corresponding to the first device information already exists in the database, and the server returns the matched device unique identification code to the client; if the match fails, it means that the user device may be a new user, and the first device information and the generated unique identification code are stored in the database, and the unique identification code is returned to the user device. After the server generates the unique identification code of the user device, it sends it to the user device, and the user device saves this unique identification code locally. In the subsequent use process, the user device preferentially obtains the unique identification code from the local cache. If the unique identification code in the local cache is cleared, it triggers the process of re-collecting the first device information and uploading it to the server to find the unique identification code.
[0070] The embodiment of the present application realizes the cooperation between the user device and the server to maintain a large amount of device information data through the above steps. The user device does not completely rely on local storage, which can avoid the risk of data being erased, and send a request to obtain it in real time when needed. The server uses a similarity algorithm such as SimHash or Jaccard to calculate the similarity of the sample and match the best result, ensuring the reliability and uniqueness of the unique identification code of the user device.
[0071] Based on the same inventive concept, the embodiment 300 of the present application also provides a device for generating a unique identification code of a device, wherein: Figure 3 As shown, the device comprises:
[0072] An acquisition module 31 is used to acquire first device information of a user device;
[0073] A search module 32, configured to search in a database whether there is second device information matching the first device information based on the first device information, and to generate a unique identification code corresponding to the user device based on the first device information if the second device information is not found;
[0074] The first sending module 33 is configured to send the unique identification code to the user equipment corresponding to the first equipment information.
[0075] In this embodiment, the specific functions and interaction methods of the acquisition module 31, the search module 32 and the first sending module 33 can be found in Figure 1 The description of the corresponding embodiments will not be repeated here.
[0076] The search module 32 includes:
[0077] a search subunit, configured to search in the data whether there is second device information that matches the basic device information, the software version information, the hardware information, and the user setting information contained in the first device information, based on the basic device information, the software version information, the hardware information, and the user setting information contained in the first device information;
[0078] The calculation subunit is used to calculate the similarity between the first device information and the stored device information in the database when the second device information is not found, and use the stored device information corresponding to the similarity greater than a preset threshold as the second device information.
[0079] The device further comprises:
[0080] The second sending module 34 is used to send the unique identification code corresponding to the second device information and stored in the database to the user device corresponding to the first device information.
[0081] The search module 32 also includes:
[0082] The generating subunit is used to compress the basic device information, device software version information, device hardware information and user setting information contained in the first device information, generate a message digest of the first device information, and use the message digest as a unique identification code of the user device.
[0083] like Figure 4 As shown, another embodiment 400 of the present application further provides a terminal device, including a processor 401, wherein the processor 401 is used to execute the steps of the above-mentioned method for generating a unique device identification code. Figure 4 It can also be seen that the terminal device provided in the above embodiment also includes a non-transitory computer-readable storage medium 402, on which a computer program is stored, and when the computer program is executed by the processor 401, the steps of the above method for generating a unique device identification code are executed. In practical applications, the terminal device can be one or more computers, as long as it includes the above computer-readable medium and processor.
[0084] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and FLASH, etc. When the computer program on the storage medium is run, each step in the above-mentioned method for generating a unique device identification code can be executed. In practical applications, the computer-readable medium can be included in the device / device / system described in the above embodiments, or it can exist independently without being assembled into the device / device / system. The above-mentioned computer-readable storage medium carries one or more programs, and when the above-mentioned one or more programs are executed, each step in the above-mentioned method for generating a unique device identification code can be executed.
[0085] According to the embodiments disclosed in the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof, but it is not used to limit the scope of protection of the present application. In the embodiments disclosed in the present application, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0086] The flow chart and block diagram in the accompanying drawings of the present application show the possible architecture, function and operation of the system, method and computer program product according to the various embodiments disclosed in the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in the order marked in different drawings. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0087] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present application. In particular, without departing from the spirit and teachings of the present application, the features described in the various embodiments and / or claims of the present application may be combined and / or combined in a variety of ways, and all of these combinations and / or combinations fall within the scope disclosed in the present application.
[0088] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still change the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these changes, modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for generating a unique device identification code, characterized in that: include: Acquire first device information of a user device; Based on the first device information, searching in a database whether there is second device information matching the first device information, and if the second device information is not found, generating a unique identification code corresponding to the user device according to the first device information; Sending the unique identification code to the user device corresponding to the first device information; After finding the second device information, the method further includes: Sending the unique identification code corresponding to the second device information and stored in the database to the user device corresponding to the first device information; The step of searching in the database whether there is second device information matching the first device information includes: According to the basic device information, the device software version information, the device hardware information and the user setting information included in the first device information, searching in the data whether there is the second device information that matches the basic device information, the device software version information, the device hardware information and the user setting information one by one; When the second device information is not found, the similarity between the first device information and the device information stored in the database is calculated, and the stored device information corresponding to the similarity greater than a preset threshold is used as the second device information.
2. The method according to claim 1, characterized in that The step of generating a unique identification code corresponding to the user equipment according to the first equipment information comprises: The basic device information, the device software version information, the device hardware information and the user setting information contained in the first device information are compressed to generate a message digest of the first device information, and the message digest is used as the unique identification code of the user device.
3. A device for generating a unique identification code for a device, characterized in that: The device comprises: An acquisition module, used to acquire first device information of a user device; a search module, configured to search in a database whether there is second device information matching the first device information based on the first device information, and to generate a unique identification code corresponding to the user device according to the first device information if the second device information is not found; A first sending module, configured to send the unique identification code to the user equipment corresponding to the first device information; Wherein, the device further comprises: A second sending module, configured to send the unique identification code corresponding to the second device information and stored in the database to the user device corresponding to the first device information; Wherein, the search module includes: a search subunit, configured to search in the data whether there is second device information that matches the basic device information, the device software version information, the device hardware information, and the user setting information contained in the first device information, based on the basic device information, the device software version information, the device hardware information, and the user setting information contained in the first device information; The calculation subunit is used to calculate the similarity between the first device information and the stored device information in the database when the second device information is not found, and use the stored device information corresponding to the similarity greater than a preset threshold as the second device information.
4. The device according to claim 3, characterized in that The search module also includes: A generating subunit is used to compress the basic device information, the device software version information, the device hardware information and the user setting information contained in the first device information, generate a message digest of the first device information, and use the message digest as the unique identification code of the user device.
5. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to perform the steps of the method for generating a unique device identification code as claimed in claim 1 or 2.
6. A terminal device, characterized in that: The method comprises a processor, wherein the processor is used to execute each step in the method for generating a unique device identification code as claimed in claim 1 or 2.
Citation Information
Patent Citations
Identification code processing method, identification code transmission method, client side, server and system
CN103905438A
Method and system for generating, storing and identifying identification code of electronic equipment
CN105871855A
Method for acquiring unique identifier of Android equipment
CN108830113A
New equipment identification method and device, server and computer readable storage medium
CN109446791A
Identity recognition equipment, recognition equipment and recognition method
CN110177093A
