A method, apparatus, electronic device, and storage medium for obtaining a user identifier.
By detecting the permissions of the target APP's storage area and identifying or generating a random code as a user identifier, the problem of user identification under strict user privacy protection is solved, and an effective identification without infringing on privacy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-11
- Publication Date
- 2026-03-06
AI Technical Summary
Under strict user privacy protection conditions, existing technologies cannot effectively identify users by obtaining hardware device information, and the risk of infringing on user privacy is high.
By detecting whether the target app has been authorized to operate on the reserved area, a random code conforming to a specified text format is identified or generated as a user identifier to avoid obtaining hardware device information.
It enables effective user identification without infringing on user privacy, thus meeting user privacy protection needs.
Smart Images

Figure CN115563594B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a user identifier acquisition method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of technology, more and more apps are emerging. Each app needs to differentiate between different users, collect and analyze user behavior, and thus optimize the user experience. For example, for video playback apps, different users can be differentiated first, and user behavior can be analyzed for each user in order to push videos that the user is interested in.
[0003] In related technologies, various apps obtain the hardware device information of the user's device, thereby identifying different users using the hardware device information. The so-called hardware device information may include: IMEI (International Mobile Equipment Identity), ANDROID_ID (unique ID of Android system devices), and DEVICE_ID (device ID), etc.
[0004] However, with the strengthening of user privacy protection and increasingly stringent access restrictions, user authorization is required when obtaining information about the hardware devices used by users. Therefore, without user authorization, access to and collection of hardware device information is impossible, and the solutions provided by relevant technologies cannot be used to identify different users.
[0005] Therefore, how to identify users without collecting hardware device information and without infringing on user privacy is an urgent problem to be solved. Summary of the Invention
[0006] The purpose of this invention is to provide a user identifier acquisition method, apparatus, electronic device, and storage medium to identify users when hardware device information cannot be collected and user privacy is not violated. The specific technical solution is as follows:
[0007] In a first aspect, embodiments of the present invention provide a user identifier acquisition method, the method comprising:
[0008] When the target APP meets the predetermined user identifier acquisition conditions, it is detected whether the target APP has been authorized by the target user to operate on the reserved area; wherein, the reserved area is the storage area reserved by the operating system of the terminal device on which the target APP runs, which is allowed to be operated by any APP after being authorized;
[0009] When it is detected that the target APP has been granted operation permissions regarding the retention area by the target user, the system identifies whether there is a storage location of the target APP in the retention area and obtains the identification result.
[0010] If the identification result is yes, a random code conforming to a specified text format is queried from the storage location of the target APP in the retention area, and the queried random code is identified as the user identifier of the target user; wherein, the queried random code is pre-generated by the target APP and written to the storage location of the target APP.
[0011] If the recognition result is negative, a random code conforming to the specified text format is generated to obtain the user identifier of the target user.
[0012] Optionally, the method further includes:
[0013] If no random code matching the specified text format is found in the storage location of the target APP in the retention area, a random code matching the specified text format is generated to obtain the user identifier of the target user.
[0014] Optionally, after generating a random code conforming to the specified text format from the storage location of the target APP in the retention area to obtain the user identifier of the target user, the method further includes:
[0015] Using the storage location of the target APP, the generated random code conforming to the specified text format is stored in the retention area.
[0016] Optionally, after generating a random code conforming to the specified text format to obtain the user identifier of the target user if the recognition result is negative, the method further includes:
[0017] The system requests the storage location of the target app in the retention area from the operating system, so that the operating system allocates the storage location of the target app in the retention area, thereby obtaining the storage location of the target app.
[0018] Using the obtained information about the target APP's storage location, the generated random code conforming to the specified text format is stored in the retention area.
[0019] Optionally, the storage location for any app is a storage location with the app's package name as the path;
[0020] The process of identifying whether the retention area contains storage locations related to the target app, and obtaining the identification result, includes:
[0021] The system identifies whether there is a storage location in the retention area that uses the target APP's package name as the path, and obtains the identification result.
[0022] Optionally, the method further includes:
[0023] If no operation permissions regarding the retention area are granted to the target APP by the target user, then the permission authentication method of the retention area of the operating system is used to request authorization from the target user.
[0024] If the request for authorization from the target user is successful, then the step of identifying whether there is a storage location for the target APP in the retention area is executed, and the identification result is obtained.
[0025] Optionally, the method further includes:
[0026] When uninstalling the target app, the user identifier of the target user in the storage location of the target app in the retention area is retained.
[0027] Secondly, embodiments of the present invention provide a user identifier acquisition device, the device comprising:
[0028] The detection module is used to detect whether the target APP has been authorized by the target user to operate on the reserved area when the target APP meets the predetermined user identifier acquisition conditions; wherein, the reserved area is the storage area reserved by the operating system of the terminal device on which the target APP runs, which is allowed to be operated by any APP after it is authorized;
[0029] The identification module is used to identify whether the target APP has a storage location in the retention area when the target APP is authorized by the target user to operate on the retention area, and to obtain the identification result;
[0030] The query module is used to, if the identification result is yes, query a random code that conforms to a specified text format from the storage location of the target APP in the retention area, and determine the queried random code as the user identifier of the target user; wherein, the queried random code is pre-generated by the target APP and written to the storage location of the target APP.
[0031] The generation module is used to generate a random code that conforms to the specified text format if the recognition result is negative, thereby obtaining the user identifier of the target user.
[0032] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0033] Memory, used to store computer programs;
[0034] The processor, when executing a program stored in memory, implements any of the described user identifier acquisition methods.
[0035] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the aforementioned user identifier acquisition methods.
[0036] This invention also provides a computer program product containing instructions that, when run on a computer, causes the computer to execute any of the user identifier acquisition methods described above.
[0037] Beneficial effects of the embodiments of the present invention:
[0038] The user identifier acquisition method provided in this invention, when the target APP meets predetermined user identifier acquisition conditions, can first detect whether the target APP has been authorized by the target user to operate on the storage area. If operation permissions exist, it can identify whether there is a storage location for the target APP in the storage area. If the identification result is yes, a random code conforming to a specified text format can be directly queried from the storage location of the target APP in the storage area, and the obtained random code is used as the user identifier of the target user. If the identification result is no, a random code conforming to a specified text format can be generated to obtain the user identifier of the target user. The user identifier acquisition method provided in this invention does not require obtaining hardware device information of the user's device, but identifies the target user based on the random code generated by the target APP used by the user. Specifically, when there is a storage location for the target APP in the storage area, a random code in a specified text format can be directly obtained as the user identifier; when there is no storage location for the target APP in the storage area, a random code in a specified text format can be generated as the user identifier of the target user. It can be seen that this solution can identify users when it is impossible to collect hardware device information and without infringing on user privacy.
[0039] Of course, implementing any product or method of the present invention does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0041] Figure 1 This is a flowchart illustrating a user identifier acquisition method provided in an embodiment of the present invention;
[0042] Figure 2 This is another flowchart illustrating a user identifier acquisition method provided in an embodiment of the present invention;
[0043] Figure 3 This is a flowchart illustrating the method for reading the target APP information retention area provided in an embodiment of the present invention;
[0044] Figure 4 This is a flowchart illustrating the method for writing information into the target APP storage area according to an embodiment of the present invention;
[0045] Figure 5 This is a schematic diagram of a user identifier acquisition device provided in an embodiment of the present invention;
[0046] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of the present invention.
[0048] In order to collect and analyze user behavior and optimize user experience, each app needs to identify each user who uses the app in order to distinguish different users and then collect and analyze user behavior for each user.
[0049] Related technologies identify users by device identification, thereby distinguishing different users. This device identification can be determined using the hardware device information used by the user. However, user authorization is required when collecting hardware device information. With the strengthening of user privacy protection, access prohibition measures are becoming increasingly strict, meaning that users usually do not authorize, thus making it impossible to collect hardware device information. In this case, related technologies cannot identify users.
[0050] Furthermore, if hardware device information continues to be collected without the user's authorization, it would infringe on the user's privacy and fail to meet strict user privacy protection measures.
[0051] Based on this, embodiments of the present invention provide a user identifier acquisition method, device, electronic device, and storage medium to identify users when it is impossible to collect hardware device information and without infringing on user privacy.
[0052] The following section first introduces a user identifier acquisition method provided by an embodiment of the present invention.
[0053] The user identifier acquisition method provided in this embodiment of the invention can be applied to terminal devices. For example, the terminal device can be a smartphone, tablet computer, desktop computer, or laptop computer, etc. This invention does not limit the specific form of the electronic device. The user identifier acquisition method provided in this embodiment of the invention can be applied to any scenario where users are identified to distinguish their identities, such as scenarios where user identifiers are needed to distinguish user identities in order to statistically analyze user behavior, etc.
[0054] Specifically, the executing entity of this user identifier acquisition method can be a user identifier acquisition device, which can be a plugin in a target APP. The target APP can be any APP that requires user identifier acquisition. For example, the target APP can be an APP that requires user identifier acquisition and is used for video playback, or an APP that requires user identifier acquisition and is used for displaying information, etc. The user identifier acquisition method provided in this embodiment of the invention may include the following steps:
[0055] When the target APP meets the predetermined user identifier acquisition conditions, it is detected whether the target APP has been authorized by the target user to operate on the reserved area; wherein, the reserved area is the storage area reserved by the operating system of the terminal device on which the target APP runs, which is allowed to be operated by any APP after being authorized;
[0056] When it is detected that the target APP has been granted operation permissions regarding the retention area by the target user, the system identifies whether there is a storage location of the target APP in the retention area and obtains the identification result.
[0057] If the identification result is yes, a random code conforming to a specified text format is queried from the storage location of the target APP in the retention area, and the queried random code is identified as the user identifier of the target user; wherein, the queried random code is pre-generated by the target APP and written to the storage location of the target APP.
[0058] If the recognition result is negative, a random code conforming to the specified text format is generated to obtain the user identifier of the target user.
[0059] The user identifier acquisition method provided in this invention, when the target APP meets predetermined user identifier acquisition conditions, can first detect whether the target APP has been authorized by the target user to operate on the storage area. If operation permissions exist, it can identify whether there is a storage location for the target APP in the storage area. If the identification result is yes, a random code conforming to a specified text format can be directly queried from the storage location of the target APP in the storage area, and the obtained random code is used as the user identifier of the target user. If the identification result is no, a random code conforming to a specified text format can be generated to obtain the user identifier of the target user. The user identifier acquisition method provided in this invention does not require obtaining hardware device information of the user's device, but identifies the target user based on the random code generated by the target APP used by the user. Specifically, when there is a storage location for the target APP in the storage area, a random code in a specified text format can be directly obtained as the user identifier; when there is no storage location for the target APP in the storage area, a random code in a specified text format can be generated as the user identifier of the target user. It can be seen that this solution can identify users when it is impossible to collect hardware device information and without infringing on user privacy.
[0060] The following is a detailed description of a user identifier acquisition method provided by an embodiment of the present invention, with reference to the accompanying drawings.
[0061] like Figure 1 As shown in the figure, a user identifier acquisition method provided by an embodiment of the present invention may include the following steps:
[0062] S101: When the target APP meets the predetermined user identifier acquisition conditions, detect whether the target APP has been authorized by the target user to operate on the retention area;
[0063] The reserved area is a storage area reserved by the operating system of the terminal device on which the target APP runs, and is allowed to be operated by any APP after it is authorized; for example, the operating system can be Android or iOS (iPhone OS), etc.
[0064] The user identifier acquisition method provided in this embodiment of the invention can acquire the user's identifier at the software level, that is, acquire the user identifier of the APP used by the user. Therefore, when the target APP meets the predetermined user identifier acquisition conditions, it can first detect whether the target APP has been granted permissions regarding the retention area by the target user, and then obtain the target user's user identifier by executing subsequent steps.
[0065] It should be noted that, for example, the predetermined user identifier acquisition condition can be the launch of the target APP. Of course, the predetermined user identifier acquisition condition can be any condition that requires distinguishing the target user's identity through a user identifier, or any condition that requires obtaining a user identifier; it is not limited here. The target APP can be any APP used by the target user. The reserved area is a storage area reserved by the operating system of the terminal device on which the target APP runs, and is allowed to operate by any APP after it has been authorized. To solve the technical problem, in this solution, the reserved area can be used to store content representing the user identifier, i.e., a random code conforming to a specified text format as described below. Therefore, when the target APP needs to obtain the user identifier, it can first check whether the target APP has been authorized by the target user to operate on the reserved area, and if it has the operating permission, it can execute subsequent steps to obtain the target user's user identifier. Furthermore, the reserved area can store user identifiers for multiple APPs used by any target user; that is, for any user, the user identifiers for different APPs are different.
[0066] Furthermore, there are various ways to detect whether a target app has been granted permission by the target user to operate on the retention area, and this is not limited to any one method. For example, in one implementation, a permission string can be used to verify whether the target app has been granted permission to operate on the retention area. The permission string is a string of a specified number of bits, where each bit represents a type of permission. Each bit can have two values: one indicating that the user has that type of permission, and the other indicating that the user does not have that type of permission. When using the permission string for verification, the target bit representing the retention area permission can be determined first, and then the value of the target bit can be determined to verify whether the user has the permission for the retention area. For example, if a permission string for the target app is 101, where each bit represents a type of permission, and for each bit's value, 1 represents having that type of permission, and 0 represents not having that type of permission; if the permission types represented by this string are: permission to use the retention area, permission to use the camera, and permission to use the contacts, then 101 indicates that the target app has permission to use the retention area and permission to use the contacts.
[0067] It should be noted that the above description of the method for detecting whether the target APP has been granted operation permissions regarding the retention area by the target user is merely an example. For any target APP, the permission verification method of the operating system of the terminal device on which it runs can be used to verify the permission of the retention area, thereby realizing whether the target APP has been granted operation permissions regarding the retention area by the target user. No limitation is made here.
[0068] S102: When it is detected that the target APP has been granted operation permissions regarding the retention area by the target user, identify whether there is a storage location of the target APP in the retention area, and obtain the identification result;
[0069] When it is detected that the target app has been granted operation permissions regarding the retention area by the target user, since the target app can operate on the retention area, and the user identifier representing the target user can be stored in the retention area, it is possible to further identify whether there is a storage location related to the target app in the retention area, obtain the identification result, and then execute subsequent steps to obtain the user identifier representing the target user. The storage location related to the target app refers to the location requested by the target app for content storage.
[0070] For example, in one implementation, the storage location of any APP is a storage location with the APP's package name as the path;
[0071] The process of identifying whether the retention area contains storage locations related to the target app, and obtaining the identification result, includes:
[0072] The system identifies whether there is a storage location in the retention area that uses the target APP's package name as the path, and obtains the identification result.
[0073] It should be noted that the storage location of any app can be a storage location with the app's package name as the path. That is, the app's package name path can indicate the app's storage location in the retention area. For example, the retention area contains multiple storage locations distinguished by the app's package name. For any app, its package name can be used to identify its corresponding storage location, and an identification result can be obtained. The identification result can be that the storage location corresponding to the app has been identified, or that the storage location corresponding to the app has not been identified. The above description of the method for identifying whether the retention area contains the storage location of the target app is merely an example and should not be construed as limiting the present invention.
[0074] In some scenarios, the target app may not have been granted permission by the target user to operate on the retention area. The method further includes:
[0075] If no operation permissions regarding the retention area are granted to the target APP by the target user, then the permission authentication method of the retention area of the operating system is used to request authorization from the target user.
[0076] If the request for authorization from the target user is successful, then the step of identifying whether there is a storage location for the target APP in the retention area is executed, and the identification result is obtained.
[0077] It is understandable that since access to the storage area does not require obtaining information about the user or the user's device, it does not infringe on user privacy, and users usually grant such permissions. However, when it is detected that the target app has not been granted access to the storage area by the target user, the app can request the target user to grant permission, thereby performing the step of identifying whether the storage area contains information about the target app and obtaining the identification result.
[0078] For example, in one implementation, the permission authentication method for the operating system's retention area can be to obtain user permissions through a pop-up window. For instance, by clicking "OK" in the pop-up window "Do you allow the APP to use the retention area permission?", the target user can authorize permissions regarding the retention area.
[0079] It should be noted that the above description of the permission authentication method for the operating system's reserved area is merely an example. For any target APP, the permission verification method of the operating system of the terminal device on which it runs can be used to obtain the target user's authorization for the reserved area, and no limitation is made here.
[0080] S103: If the identification result is yes, query the storage location of the target APP in the retention area to find a random code that conforms to the specified text format, and determine the queried random code as the user identifier of the target user;
[0081] The random code retrieved is pre-generated by the target APP and written to the storage location of the target APP.
[0082] If the identification result is yes, it means that the storage location of the target APP in the retention area has been identified. This storage location may store a random code that conforms to a specified text format. The random code that conforms to the specified text format can be queried from the storage location of the target APP, and the queried random code is used as the user identifier of the target user.
[0083] It should be noted that this storage location can be used solely to store a random code conforming to a specified text format, serving as a user identifier for the target user, or it can store other information; this is not limited here. When this storage location is used solely to store the random code, it is possible to query whether content is stored in the target app's storage location. If it exists, the stored content can be used as a random code conforming to the specified text format, and the retrieved random code will be identified as the target user's user identifier. In other words, by querying whether content is stored in the target app's storage location, a random code conforming to the specified text format can be retrieved. When this storage location stores the random code and other information, it is possible to query whether a random code conforming to the specified text format exists in the content stored in this storage location. If it exists, the random code will be used as the target user's user identifier.
[0084] It should be noted that the random code in the specified text format can be a pre-set random code used to identify the user. The specified text format can be any pre-set format, and there is no limitation here. For example, the random code in the specified text format can be a random code containing numbers and letters with a predetermined string length.
[0085] For example, in one implementation, the method further includes:
[0086] When uninstalling the target app, the user identifier of the target user in the storage location of the target app in the retention area is retained.
[0087] It should be noted that the target user may uninstall the target app, or reinstall the target app. In order to ensure that the user identifier of the target app remains unchanged after the target app is uninstalled and reinstalled, the user identifier of the target user in the storage location of the target app in the retention area can be retained.
[0088] S104: If the recognition result is negative, a random code conforming to the specified text format is generated to obtain the user identifier of the target user;
[0089] If the identification result is negative, meaning that the storage location of the target APP in the retention area is not identified, then there is no random code in the retention area that conforms to the specified text format. In this case, a random code that conforms to the specified text format can be directly generated to serve as the user identifier of the target user.
[0090] It should be noted that the method for generating a random code conforming to the specified text format can be by using a string to generate a random code conforming to the specified text format. For example, the random code in the specified text format can be a random code containing numbers and letters with a predetermined string length. The random code in the specified text format can be a pre-set random code used to identify the user, and the specified text format can be any pre-set format, which is not limited here.
[0091] The user identifier acquisition method provided in this invention, when the target APP meets predetermined user identifier acquisition conditions, can first detect whether the target APP has been authorized by the target user to operate on the storage area. If operation permissions exist, it can identify whether there is a storage location for the target APP in the storage area. If the identification result is yes, a random code conforming to a specified text format can be directly queried from the storage location of the target APP in the storage area, and the obtained random code is used as the user identifier of the target user. If the identification result is no, a random code conforming to a specified text format can be generated to obtain the user identifier of the target user. The user identifier acquisition method provided in this invention does not require obtaining hardware device information of the user's device, but identifies the target user based on the random code generated by the target APP used by the user. Specifically, when there is a storage location for the target APP in the storage area, a random code in a specified text format can be directly obtained as the user identifier; when there is no storage location for the target APP in the storage area, a random code in a specified text format can be generated as the user identifier of the target user. It can be seen that this solution can identify users when it is impossible to collect hardware device information and without infringing on user privacy.
[0092] Optionally, in another embodiment, after generating a random code conforming to the specified text format to obtain the user identifier of the target user if the identification result is negative, the method further includes:
[0093] The system requests the storage location of the target app in the retention area from the operating system, so that the operating system allocates the storage location of the target app in the retention area, thereby obtaining the storage location of the target app.
[0094] Using the obtained information about the target APP's storage location, the generated random code conforming to the specified text format is stored in the retention area.
[0095] If the identification result is negative, meaning there is no storage location for the target app in the retention area, this solution can generate a random code conforming to a specified text format as the target user's identifier. After obtaining the user identifier, to facilitate the target app's subsequent retrieval of the target user's identifier, it can request the storage location for the target app in the retention area from the operating system. The operating system can allocate a storage location in the retention area for the target app, and then use this allocated storage location to store the generated random code conforming to the specified text format in the retention area. Subsequently, the target user's identifier can be directly retrieved from the target app's storage location in the retention area.
[0096] It should be noted that when allocating storage locations in the retention area for a target app, the package name of the target app can be used as the path to allocate storage locations for the target app. This way, when retrieving the user identifier of the target user from that storage location, the package name of the target app can be used as the path to determine the storage location of the target app.
[0097] By allocating storage locations within the retention area to the target app, the generated random code in a specified text format can be stored in the retention area. When the target app needs to obtain the user's identifier later, it can directly retrieve the user's identifier from this storage location, thereby improving the efficiency of user identifier retrieval.
[0098] Optionally, in another embodiment, the method further includes:
[0099] If no random code matching the specified text format is found in the storage location of the target APP in the retention area, a random code matching the specified text format is generated to obtain the user identifier of the target user.
[0100] It should be noted that the retention area can store information about the target app's storage location. This storage location may not contain a random code in a specified text format. In this case, a random code that conforms to the specified text format can be generated as the target user's identifier.
[0101] For example, in one implementation, after generating a random code conforming to the specified text format from the storage location of the target APP in the retention area to obtain the user identifier of the target user, the method further includes:
[0102] Using the storage location of the target APP, the generated random code conforming to the specified text format is stored in the retention area.
[0103] Since the target app's storage location may not contain a random code in the specified text format, after generating a random code in the specified text format, in order to facilitate the acquisition of the target user's user identifier in the next and subsequent times, the generated random code can be stored in the retention area using the target app's storage location.
[0104] The user identifier acquisition method provided by this invention can generate a random code that conforms to the specified text format when there is no random code in the storage location of the target APP, thereby obtaining the user identifier of the target user. Furthermore, the generated random code can be stored in the retention area using the storage location of the target APP, so as to query the user identifier of the target user for the target APP in the future, thereby improving the efficiency of user identifier acquisition.
[0105] The following is combined Figure 2 Taking the Android system as an example, an embodiment of the present invention provides an exemplary description of a user identifier acquisition method.
[0106] like Figure 2 As shown, the user identifier acquisition method provided in this embodiment of the invention may include the following steps:
[0107] S201: Launch the target APP; This embodiment of the invention obtains the user identifier of the target user for the target APP. Before obtaining the user identifier, the target APP can be launched first, that is, the predetermined user identifier acquisition conditions mentioned above, so as to obtain the user identifier by executing subsequent steps.
[0108] S202: Read the target APP information storage area through system methods; after launching the target APP, the information in the target APP information storage area can be read using the operating system (such as Android system) of the terminal device on which the target APP runs. The target APP information storage area is the storage area mentioned above. A detailed explanation of step S202 will be provided later and will not be repeated here.
[0109] S203: Does the returned content contain a random code? That is, does the content of the target APP information storage area contain a random code? The random code is the random code that conforms to the specified text format mentioned above. If the result is yes, proceed to step S204. If the result is no, proceed to step S205.
[0110] S204: As a software device identifier; that is, the returned content contains a random code, which can be used as a software device identifier. The software device identifier is the user's identity identifier for the target APP, corresponding to the user identifier of the target user for the target APP mentioned above. Corresponding to the above querying the random code that conforms to the specified text format from the storage location of the target APP in the retention area, the queried random code is determined as the user identifier of the target user.
[0111] S205: Generate a random code; that is, if the returned content does not contain a random code, a random code can be generated and used as a software device identifier. Corresponding to the above-described generation of a random code conforming to the specified text format, the user identifier of the target user is obtained.
[0112] S206: Write the generated random code to the target APP information storage area through a system method; that is, when the returned content does not contain a random code, the method of the operating system (such as Android system) of the terminal device on which the target APP runs can be used to write the generated random code to the target APP information storage area; a detailed explanation of step S206 will be provided later, and will not be repeated here.
[0113] This solution allows the target app to read the content of its information storage area. If a random code is obtained, it is directly used as the software device identifier. If no random code is obtained, a random code can be generated as the software device identifier and written into the target app's information storage area for later use. This invention implements a method for the target app to use a software device identifier as a unique identifier. The target app can generate a random code as its software device identifier, and an authorization mechanism for accessing the app's information storage area is set up. The app itself generates and maintains the software device identifier information, protecting user privacy. This allows for user identification even when hardware device information cannot be collected and user privacy is not violated.
[0114] Additionally, when uninstalling the app, the Android system does not clear the storage information under the package name path in the app information storage area.
[0115] By permanently storing information in the APP's information storage area, the software device identifier for the APP remains unchanged even if the APP is uninstalled and reinstalled, thus satisfying the APP's need to identify the user's device and subsequently analyze user behavior.
[0116] The following is combined Figure 3 The above step S202 will be described in detail.
[0117] like Figure 3 As shown, the process of the target app reading the target app's information storage area by calling system methods includes the following steps:
[0118] S301: Does the app have permission? This means using the permission verification method provided by the system to check whether the target app has permission to operate in the retention area. If the detection result is yes, proceed to step S302; if the detection result is no, proceed to step S303. This corresponds to the above detection of whether the target app has been authorized by the target user to operate in the retention area.
[0119] S302: Does the retention area contain the target APP package name path? After detecting that the target APP has operation permissions in the retention area, it can be further identified whether the retention area contains the target APP package name path. If the identification result is yes, proceed to step S305. If the identification result is no, proceed to step S304. Corresponding to the above identification, whether there is a storage location in the retention area with the target APP package name as the path, the identification result is obtained.
[0120] S303: Returns null; that is, the target APP does not have the permission to operate in the storage area. You can use the permission acquisition method provided by the system to request authorization from the user. If authorization still fails, the information in the target APP's information storage area cannot be read, and the result will be blank. If authorization is successful, you can proceed to step S302.
[0121] S304: Returns null; that is, the target APP package name path is not found in the retention area, meaning the storage location of the target APP does not exist in the retention area. In this case, the information in the retention area of the target APP cannot be read, so the result is blank.
[0122] S305: Return the storage information under the path corresponding to the package name in the retention area; when the target APP package name path exists in the retention area, the storage information can be read from the target APP package name path and the storage information under the path corresponding to the package name in the retention area can be returned; corresponding to the above-mentioned storage location of the target APP in the retention area, query a random code that conforms to the specified text format, and the queried random code can be determined as the user identifier of the target user.
[0123] The target app can read the storage information in the target app's information retention area by calling system methods. First, it can be checked whether the target app has permission to retain the information in the retention area, and the storage location in the retention area with the target app's package name as the path can be determined. The corresponding storage information can be read from that storage location. This solution can realize the reading of the target app's information retention area storage information through system methods, thereby subsequently determining the target user's user identifier for the target app.
[0124] The following is combined Figure 4 The above step S206 will be described in detail.
[0125] like Figure 4As shown, the target app writes information to the target app storage area through system methods, including the following steps;
[0126] S401: Permission Status; This involves using the system-provided permission verification method to check whether the target app has permission to operate in the retention area. If the result is yes, proceed to step S402; if the result is no, proceed to step S403. This corresponds to the above-mentioned check of whether the target app has been authorized by the target user to operate in the retention area. Of course, if the operation permission for the retention area has already been verified, this step can be omitted.
[0127] S402: Does the retention area contain the target APP package name path? After detecting that the target APP has operation permissions in the retention area, it can be further identified whether the retention area contains the target APP package name path. If the identification result is yes, proceed to step S405; if the identification result is no, proceed to step S404. Corresponding to the above identification, whether there is a storage location in the retention area with the target APP package name as the path, the identification result is obtained.
[0128] S403: End; This means the target app does not have permission for the retention area. The system-provided permission acquisition method can be used to request user authorization. If authorization still fails, the user cannot be identified, and the process can end or return a blank result. If authorization is successful, step S402 can continue. If authorization still fails, after the user uninstalls and reinstalls the target app, the user will be identified as a new user. If authorization is successful at this point, a random code can be generated as the user's software device identifier. This random code can be stored in the retention area for later use.
[0129] S404: The system creates a path corresponding to the target APP package name in the retention area; if the retention area does not have a path for the target APP package name, it can request the operating system to create a path corresponding to the target APP package name in the retention area, corresponding to the above request to the operating system for the storage location of the target APP in the retention area, so that the operating system allocates a storage location in the retention area for the target APP, thereby obtaining the storage location of the target APP.
[0130] S405: Write to the storage area under the path corresponding to the package name in the retention area; when the target APP package name path exists in the retention area or the system creates the target APP package name path in the retention area, the generated random code can be written to the storage area under the path corresponding to the package name in the retention area. Corresponding to the storage location of the target APP mentioned above, the generated random code that conforms to the specified text format is stored in the retention area.
[0131] The target app can write a random code into its information storage area by calling a system method. First, it can be checked whether the target app has permission to store the code in this area, and then the storage location with the target app's package name as the path can be determined. This storage location can then be used to write the generated random code into the target app's information storage area. This solution allows writing a random code into the target app's information storage area by calling a system method. Subsequently, the random code can be retrieved from this storage area, thereby determining the target user's identifier for the target app.
[0132] Based on the above-described user identifier acquisition method, embodiments of the present invention also provide a user identifier acquisition device, such as... Figure 5 As shown, the device includes:
[0133] The detection module 510 is used to detect whether the target APP has been authorized by the target user to operate on the reserved area when the target APP meets the predetermined user identifier acquisition conditions; wherein, the reserved area is the storage area reserved by the operating system of the terminal device on which the target APP runs, which is allowed to be operated by any APP after it is authorized;
[0134] The identification module 520 is used to identify whether there is a storage location of the target APP in the retention area when the target APP is authorized by the target user to operate on the retention area, and to obtain the identification result;
[0135] The query module 530 is used to, if the identification result is yes, query a random code that conforms to a specified text format from the storage location of the target APP in the retention area, and determine the queried random code as the user identifier of the target user; wherein, the queried random code is pre-generated by the target APP and written to the storage location of the target APP.
[0136] The generation module 540 is used to generate a random code that conforms to the specified text format if the recognition result is negative, so as to obtain the user identifier of the target user.
[0137] The user identifier acquisition device provided in this embodiment of the invention, when the target APP meets the predetermined user identifier acquisition conditions, can first detect whether the target APP has been authorized by the target user to operate on the storage area. If operation permissions exist, it can identify whether there is a storage location for the target APP in the storage area. If the identification result is yes, it can directly query a random code conforming to a specified text format from the storage location of the target APP in the storage area, and use the obtained random code as the user identifier of the target user; if the identification result is no, it can generate a random code conforming to a specified text format, thereby obtaining the user identifier of the target user. The user identifier acquisition method provided by this invention does not require obtaining hardware device information of the user's device, but identifies the target user based on the random code generated by the target APP used by the user. Specifically, when there is a storage location for the target APP in the storage area, a random code in a specified text format can be directly obtained as the user identifier; when there is no storage location for the target APP in the storage area, a random code in a specified text format can be generated as the user identifier of the target user. It can be seen that this solution can identify users when it is impossible to collect hardware device information and without infringing on user privacy.
[0138] Optionally, the generation module is further configured to:
[0139] If no random code matching the specified text format is found in the storage location of the target APP in the retention area, a random code matching the specified text format is generated to obtain the user identifier of the target user.
[0140] Optionally, the device further includes:
[0141] The storage module is used to store the generated random code conforming to the specified text format in the retention area using the storage location of the target APP.
[0142] Optionally, the device further includes:
[0143] The first request module is used to request the storage location of the target APP in the retention area from the operating system, so that the operating system allocates the storage location in the retention area for the target APP, thereby obtaining the storage location of the target APP; and using the obtained storage location of the target APP, storing the generated random code that conforms to the specified text format into the retention area.
[0144] Optionally, the storage location for any app is a storage location with the app's package name as the path;
[0145] The identification module is specifically used for:
[0146] The system identifies whether there is a storage location in the retention area that uses the target APP's package name as the path, and obtains the identification result.
[0147] Optionally, the device further includes:
[0148] The second request module is used to request authorization from the target user using the permission authentication method of the operating system's retention area if no operation permission for the target APP regarding the retention area is authorized by the target user; if the request for authorization from the target user is successful, the step of identifying whether there is a storage location of the target APP in the retention area and obtaining the identification result is executed.
[0149] Optionally, the device further includes:
[0150] The retention module is used to retain the user identifier of the target user in the storage location of the target APP in the retention area when the target APP is uninstalled.
[0151] This invention also provides an electronic device, such as... Figure 6 As shown, it includes a processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other through the communication bus 604.
[0152] Memory 603 is used to store computer programs;
[0153] The processor 601 is used to implement any user identifier acquisition method when executing a program stored in the memory 603.
[0154] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0155] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0156] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0157] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0158] In another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program, when executed by a processor, implements any of the above-described user identifier acquisition methods.
[0159] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the user identifier acquisition methods described above.
[0160] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0161] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover 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.
[0162] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0163] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A user identification acquisition method, characterized by, The method is applied to a target APP, and comprises the following steps: When the target APP is started, it is detected whether the target APP is authorized by a target user to have an operation permission on a reserved area; wherein the reserved area is a storage area reserved by an operating system of a terminal device on which the target APP runs, and the storage area allows an APP to operate after the APP is authorized; When it is detected that the target APP is authorized by the target user to have the operation permission on the reserved area, it is identified whether there is a storage location of the target APP in the reserved area, and an identification result is obtained; wherein the storage location of the target APP is a location applied by the target APP for content storage; If the identification result is yes, a random code conforming to a specified text format is queried from the storage location of the target APP in the reserved area, and the queried random code is determined as a user identifier of the target user; wherein the queried random code is generated in advance by the target APP and written into the storage location of the target APP; If the identification result is no, a random code conforming to the specified text format is generated, and the user identifier of the target user is obtained; wherein for any user, the user identifiers of different APPs used by the user are different; The operating system is requested to have the storage location of the target APP in the reserved area, so that the operating system allocates the storage location in the reserved area to the target APP, and the storage location of the target APP is obtained; The generated random code conforming to the specified text format is stored into the reserved area by using the obtained storage location of the target APP; When the target APP is uninstalled, the user identifier of the target user under the storage location of the target APP in the reserved area is retained.
2. The method of claim 1, wherein, The method further comprises: If a random code conforming to a specified text format is not queried from the storage location of the target APP in the reserved area, a random code conforming to the specified text format is generated, and the user identifier of the target user is obtained.
3. The method of claim 2, wherein, After the random code conforming to the specified text format is generated, the method further comprises: The generated random code conforming to the specified text format is stored into the reserved area by using the storage location of the target APP.
4. The method of claim 1, wherein, The storage location of any APP is a storage location with a package name of the APP as a path; The identification of whether there is the storage location of the target APP in the reserved area and the obtaining of the identification result comprise the following steps: It is identified whether there is a storage location with a package name of the target APP as a path in the reserved area, and an identification result is obtained.
5. The method of claim 1, wherein, The method further comprises: If it is not detected that the target APP is authorized by the target user to have the operation permission on the reserved area, the target user is requested to be authorized by using a permission authentication mode of the reserved area of the operating system; If the target user authorization request succeeds, the step of identifying whether the storage location for the target APP exists in the reserved area is performed to obtain an identification result.
6. A user identification acquisition apparatus characterized by comprising: The device is applied to a target APP, and comprises: a detection module configured to detect whether the target APP is authorized by a target user to have an operation permission on a reserved area when the target APP is started, wherein the reserved area is a storage area reserved by an operating system of a terminal device on which the target APP runs and which allows an APP to operate after the APP is authorized; an identification module configured to identify whether a storage location for the target APP exists in the reserved area when it is detected that the target APP is authorized by the target user to have the operation permission on the reserved area, to obtain an identification result, wherein the storage location for the target APP is a location applied by the target APP for content storage; a query module configured to query a random code in a specified text format from the storage location for the target APP in the reserved area if the identification result is yes, and determine the queried random code as a user identifier of the target user, wherein the random code is generated by the target APP in advance and written into the storage location for the target APP; a generation module configured to generate a random code in the specified text format if the identification result is no, to obtain the user identifier of the target user, wherein the user identifier of a different APP used by any user is different; a first request module configured to request the operating system for the storage location for the target APP in the reserved area, so that the operating system allocates a storage location in the reserved area for the target APP, to obtain the storage location for the target APP, and store the generated random code in the specified text format into the reserved area by using the obtained storage location for the target APP; a reservation module configured to reserve the user identifier of the target user under the storage location for the target APP in the reserved area when the target APP is uninstalled.
7. An electronic device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus; the memory is configured to store a computer program; the processor is configured to execute the program stored on the memory, to implement the user identifier acquisition method in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer program is stored in the computer readable storage medium, and the computer program is executed by the processor to implement the user identifier acquisition method in any one of claims 1-5.
Citation Information
Patent Citations
Method and system for reading user identification information, computer storage medium and device
CN108282475A
Generation method of unique identification code of mobile terminal equipment for controlling security risk
CN111601304A