Disclosure of Invention
The embodiment of the disclosure provides a method and a device for collecting equipment information.
In a first aspect, an embodiment of the present disclosure provides a method for collecting device information, applied to an android terminal, including: in response to receiving a request to start a process of a target application, starting a data acquisition service process; the process of the target application sends an acquisition request to a data acquisition service process; the data acquisition service process sends the equipment information of the android terminal to a server; the data acquisition service process receives the equipment identification returned by the server and returns the equipment identification to the process of the target application.
In some embodiments, the method further comprises: in response to detecting an anomaly in the data acquisition service process, an anomaly log is generated.
In some embodiments, the method further comprises: enabling a monitoring service process; the monitoring service process collects exception logs and uploads the exception logs to the server.
In some embodiments, the method further comprises: if the exception is a crash or a deadlock, restarting the data acquisition service process.
In some embodiments, the method further comprises: the process of the target application sends a risk analysis request comprising a device identifier to a server; the process of the target application receives the result of risk analysis sent by the server.
In a second aspect, embodiments of the present disclosure provide a method for collecting device information, applied to a server, including: generating a device identifier according to the device information in response to receiving the device information of the android terminal; and sending the device identifier to the android terminal.
In some embodiments, the method further comprises: in response to receiving a risk analysis request comprising a device identifier from an android terminal, performing risk analysis on the android terminal according to device information to obtain a risk analysis result; and sending the analysis result to a process of a target application of the android terminal.
In some embodiments, the generating the device identification from the device information includes: searching whether equipment information exists in a corresponding relation table of the equipment information and the equipment identifier; if the device identification does not exist, generating a device identification according to the device information and storing the device identification into a corresponding relation table; if so, acquiring the searched equipment identification.
In a third aspect, an embodiment of the present disclosure provides an apparatus for collecting device information, applied to an android terminal, including: a starting unit configured to start a data acquisition service process in response to receiving a request to start a process of a target application; the acquisition unit is configured to send an acquisition request to a data acquisition service process by a process of the target application; the sending unit is configured to send the device information of the android terminal to the server by the data acquisition service process; and the receiving unit is configured to receive the equipment identifier returned by the server by the data acquisition service process and return the equipment identifier to the process of the target application.
In some embodiments, the apparatus further comprises a log unit configured to: in response to detecting an anomaly in the data acquisition service process, an anomaly log is generated.
In some embodiments, the apparatus further comprises a monitoring unit configured to: enabling a monitoring service process; the monitoring service process collects exception logs and uploads the exception logs to the server.
In some embodiments, the apparatus further comprises a restart unit configured to: if the exception is a crash or a deadlock, restarting the data acquisition service process.
In some embodiments, the apparatus further comprises a querying unit configured to: the process of the target application sends a risk analysis request comprising a device identifier to a server; the process of the target application receives the result of risk analysis sent by the server.
In a fourth aspect, embodiments of the present disclosure provide an apparatus for collecting device information, applied to a server, including: the generating unit is configured to respond to the received device information of the android terminal and generate a device identifier according to the device information; and the sending unit is configured to send the device identifier to the android terminal.
In some embodiments, the apparatus further comprises an analysis unit configured to: in response to receiving a risk analysis request comprising a device identifier from an android terminal, performing risk analysis on the android terminal according to device information to obtain a risk analysis result; and sending the analysis result to a process of a target application of the android terminal.
In some embodiments, the generating unit is further configured to: searching whether equipment information exists in a corresponding relation table of the equipment information and the equipment identifier; if the device identification does not exist, generating a device identification according to the device information and storing the device identification into a corresponding relation table; if so, acquiring the searched equipment identification.
In a fifth aspect, embodiments of the present disclosure provide an electronic device for collecting device information, comprising: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement a method as in any of the first or second aspects.
In a sixth aspect, embodiments of the present disclosure provide a computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements a method as in any of the first or second aspects.
In addition, the component can be bound to the Service to interact with the Service and even execute inter-process communication (IPC)), and release SDK real-time functions in a form of executing the inter-process communication (IPC), so that the function of the SDK can be used by the app through the IPC call form, the app and the SDK can be effectively separated into two independent running processes, so that the app cannot crash and deadlock caused by the defect of the SDK and normal running of the app is ensured.
In addition, on the basis of completing the basic function of the SDK, a monitoring service is started at the same time and used for monitoring the running state of the SDK, if the SDK service is crashed and deadlocked, the crash and deadlock information is collected and submitted to a background server for debugging and improvement of developers; while restarting the SDK service enables the app to continue using the service.
In a word, the scheme thoroughly solves the fatal problems of breakdown, deadlock and the like caused by the integrated SDK of the app, and can monitor the SDK service to keep normal operation and collect the uploading defect information for improvement of developers.
Detailed Description
The present disclosure is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, without conflict, the embodiments of the present disclosure and features of the embodiments may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 to which embodiments of the methods of the present disclosure for or apparatuses for collecting device information may be applied.
As shown in fig. 1, the system architecture 100 may include android terminals 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide a communication link between the android terminals 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 through the network 104 using the android terminals 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a web browser application, a shopping class application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc., may be installed on the android terminals 101, 102, 103.
The android terminals 101, 102, 103 may be hardware or software. When the android terminals 101, 102, 103 are hardware, various electronic devices supporting the android operating system may be used, including but not limited to smartphones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic video expert compression standard audio plane 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic video expert compression standard audio plane 4) players, laptop and desktop computers, and the like. When the android terminals 101, 102, 103 are software, they can be installed in the above-listed electronic devices. Which may be implemented as multiple software or software modules (e.g., to provide distributed services), or as a single software or software module. The present invention is not particularly limited herein.
The server 105 may be a server providing various services, such as a background application server providing support for a certain app running on the android terminal 101, 102, 103. The background application server can analyze and other processes on the received device information, and feed back a processing result (such as a device identifier) to the android terminal. And risk analysis can be performed according to the equipment information to judge whether the android terminal is a simulator for fraud.
The server may be hardware or software. When the server is hardware, the server may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (e.g., a plurality of software or software modules for providing distributed services), or as a single software or software module. The present invention is not particularly limited herein.
It should be noted that, the method for collecting device information provided by the embodiments of the present disclosure may be performed by the android terminals 101, 102, 103, or may be performed by the server 105. Accordingly, the device for collecting the device information may be disposed in the android terminals 101, 102, 103, or may be disposed in the server 105. The present invention is not particularly limited herein.
It should be understood that the number of android terminals, networks and servers in fig. 1 is merely illustrative. There may be any number of android terminals, networks, and servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of a method for collecting device information according to the present disclosure applied to an android terminal is shown. The method for collecting equipment information comprises the following steps:
in step 201, a data acquisition service process is started in response to receiving a request to start a process of a target application.
In the present embodiment, an execution subject of a method for collecting device information (for example, an android terminal shown in fig. 1) is installed with a target application, for example, an investment-type app. If the user clicks the icon of the target application, a request for starting the process of the target application is triggered, and the process of the target application is started. And starting the process of the target application and simultaneously starting the data acquisition service process. The data acquisition Service process is a process in which the SDK independently operates in an Android Service mode, and is not operated in the same process with the app.
In step 202, the process of the target application sends a collection request to the data collection service process.
In this embodiment, after the data acquisition service process is started, the process of the target application sends an acquisition request to the data acquisition service process in an inter-process communication (IPC) manner, so as to invoke the SDK for device information acquisition. The data acquisition service process then acquires the device information. The device information may include information that a model, a phone number, a SIM card number, an electric quantity, a latitude and longitude, etc. are available to analyze whether the android terminal is an analog machine within a range allowed by law. Optionally, before collecting the information, the user is queried in a license-authorized manner whether to agree to collect the device information. The target application cannot be used if the acquisition of the device information is not agreed. If the acquisition of the device information is agreed, the device information is acquired by the content authorized by the license. If the user is only allowed to collect part of the information, his licensed information may be collected. For example, the user may disable the collection of location information and may collect other information. Acquisition requests may be sent periodically to obtain real-time device information, e.g., power information may be obtained every 5 minutes.
And 203, the data acquisition service process sends the device information of the android terminal to a server.
In this embodiment, the data acquisition service process directly sends the acquired device information to the server. The information that the user allows to collect can be sent to the server at one time. The format of the device information may be agreed with the server in advance. For example, in JSON (JavaScript Object Notation, JS object profile) format, for example: { "model": "Hua Cheng", "telephone number": 13912345678}.
After receiving the device information, the server searches whether the device information exists in a corresponding relation table of the device information and the device identifier. If not, generating a device identifier according to the device information, and storing the device identifier in a corresponding relation table. If so, acquiring the searched equipment identification. The device identification may uniquely identify the android terminal. And the server returns the device identification to the android terminal. The specific process is shown in flow 300.
In some optional implementations of the present embodiments, the data acquisition service process may generate an exception log when an exception to the data acquisition service process is detected. An exception log may also be generated by the android system. The exception may be a crash or a deadlock, etc.
In some alternative implementations of the present embodiment, a monitoring service process is enabled; the monitoring service process collects exception logs and uploads the exception logs to the server. Whether the data acquisition service process is abnormal or not can be detected regularly in a heartbeat detection mode, and if the data acquisition service process is abnormal, an abnormal log is collected and uploaded to a server. For the developer to analyze the cause of the abnormality.
In some alternative implementations of the present embodiment, if the exception is a crash or a deadlock, the data acquisition service process is restarted. The occurrence of an anomaly may lead to failure of information acquisition and therefore requires re-acquisition.
In step 204, the data acquisition service process receives the device identifier returned by the server and returns the device identifier to the process of the target application.
In this embodiment, the device identifier is mainly used to uniquely identify the device, and ideally each device is identified by a unique device identifier that is not repeated, and then the app involved in the business of wind control, anti-fraud, etc. can use this device identifier to identify the device.
In some optional implementations of this embodiment, the process of the target application sends a risk analysis request including the device identification to the server; the process of the target application receives the result of risk analysis sent by the server. And the target application judges the risk of the equipment according to the risk analysis result, and if the risk is higher than the threshold value, the android terminal is forbidden to use the target application.
With continued reference to fig. 3, a flow 300 of one embodiment of a method for collecting device information according to the present disclosure applied to a server is shown. The method for collecting equipment information comprises the following steps:
step 301, in response to receiving the device information of the android terminal, generating a device identifier according to the device information.
In this embodiment, the execution subject of the method for collecting device information (e.g., the server shown in fig. 1) is the background server of the target application in step 201. The server receives device information from the android terminal. Searching whether equipment information exists in a corresponding relation table of the equipment information and the equipment identifier; if the device identification does not exist, generating a device identification according to the device information and storing the device identification into a corresponding relation table; if so, acquiring the searched equipment identification. The device identification may be generated according to a predetermined rule, e.g., model + handset number + SIM card number.
And step 302, transmitting the device identifier to the android terminal.
In this embodiment, the newly generated device identifier or the device identifier generated before is sent to the android terminal.
In some optional implementations of the embodiment, in response to receiving a risk analysis request including a device identifier from the android terminal, performing risk analysis on the android terminal according to the device information to obtain a risk analysis result; and sending the analysis result to a process of a target application of the android terminal. The server can judge the risk of the android terminal according to a preset rule. For example, if the power information is not changed all the time, the security Zhuo Zhongduan is suspected to be an analog machine. The weighting sum may be scored comprehensively from multiple aspects. For example, the degree of change in the electricity (the risk is high if the electricity is always the same), the degree of matching between the model and the telephone number (for example, the risk is high if the number is a number for a mobile customized machine, but the risk is high), the score of the area where the longitude and latitude are located, for example, the risk is high if the longitude and latitude are phishing multiple areas.
With continued reference to fig. 4, fig. 4 is a schematic diagram of an application scenario of the method for collecting device information according to the present embodiment. In the application scenario of fig. 4, the user app layer mainly is app self-running logic developed by a user, the SDK layer provides a function API that the app needs to call and self-state monitoring, and uploads device data and a crash log by calling a Restful API of a background server layer to accept a device identifier issued by the server layer; the user app and the SDK layer are two processes independent of each other, so the app does not crash due to the crash of the SDK layer.
There are various ways for the user app to start, stop and use the android service. This is prior art and will not be described in detail. The specific flow is as follows:
first, when the app is started, a data acquisition service process is started.
And secondly, after the data acquisition service process is started, starting a monitoring service process, uploading an abnormal log if the data acquisition service process is monitored to crash or deadlock, and restarting the data acquisition service process.
And thirdly, the app calls an API in a data acquisition service process to start data acquisition.
And fourthly, sending the acquired data to a server, and generating and issuing a device identifier for distinguishing and identifying the device by the server.
With further reference to fig. 5, as an implementation of the method shown in the foregoing figures, the present disclosure provides an embodiment of an apparatus for collecting device information applied to an android terminal, where an embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, the apparatus 500 for collecting device information of the present embodiment includes: a starting unit 501, an acquisition unit 502, a sending unit 503 and a receiving unit 504. Wherein, the starting unit 501 is configured to start a data acquisition service process in response to receiving a request for starting a process of a target application; the acquisition unit 502 is configured to send an acquisition request to a data acquisition service process by a process of a target application; a sending unit 503 configured to send device information of the android terminal to a server by a data acquisition service process; and the receiving unit 504 is configured to receive the device identifier returned by the server and return the device identifier to the process of the target application by the data acquisition service process.
In this embodiment, specific processes of the starting unit 501, the collecting unit 502, the transmitting unit 503, and the receiving unit 504 of the apparatus 500 for collecting device information may refer to steps 201, 202, 203, 204 in the corresponding embodiment of fig. 2.
In some optional implementations of the present embodiment, the apparatus 500 further includes a log unit (not shown in the drawings) configured to: in response to detecting an anomaly in the data acquisition service process, an anomaly log is generated.
In some optional implementations of the present embodiment, the apparatus 500 further includes a monitoring unit (not shown in the drawings) configured to: enabling a monitoring service process; the monitoring service process collects exception logs and uploads the exception logs to the server.
In some optional implementations of the present embodiment, the apparatus 500 further includes a restarting unit (not shown in the drawings) configured to: if the exception is a crash or a deadlock, restarting the data acquisition service process.
In some optional implementations of the present embodiment, the apparatus 500 further includes a query unit (not shown in the drawings) configured to: the process of the target application sends a risk analysis request comprising a device identifier to a server; the process of the target application receives the result of risk analysis sent by the server.
With further reference to fig. 6, as an implementation of the method shown in the foregoing figures, the present disclosure provides an embodiment of an apparatus for collecting device information applied to a server, where an embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 3, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 6, the apparatus 600 for collecting device information of the present embodiment includes: a generating unit 601 and a transmitting unit 602. Wherein, the generating unit 601 is configured to generate a device identifier according to the device information in response to receiving the device information of the android terminal; and a sending unit 602 configured to send the device identifier to the android terminal.
In this embodiment, specific processing of the generating unit 601 and the transmitting unit 602 of the apparatus 600 for collecting device information may refer to steps 301 and 302 in the corresponding embodiment of fig. 3.
In some optional implementations of the present embodiment, the apparatus 600 further comprises an analysis unit (not shown in the drawings) configured to: in response to receiving a risk analysis request comprising a device identifier from an android terminal, performing risk analysis on the android terminal according to device information to obtain a risk analysis result; and sending the analysis result to a process of a target application of the android terminal.
In some optional implementations of the present embodiment, the generating unit 601 is further configured to: searching whether equipment information exists in a corresponding relation table of the equipment information and the equipment identifier; if the device identification does not exist, generating a device identification according to the device information and storing the device identification into a corresponding relation table; if so, acquiring the searched equipment identification.
Referring now to fig. 7, a schematic diagram of an electronic device (e.g., server or android terminal in fig. 1) 700 suitable for use in implementing embodiments of the present disclosure is shown. The android terminals in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The android terminal/server illustrated in fig. 7 is merely an example, and should not impose any limitations on the functionality and scope of use of embodiments of the present disclosure.
As shown in fig. 7, the electronic device 700 may include a processing means (e.g., a central processor, a graphics processor, etc.) 701, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage means 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
In general, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 shows an electronic device 700 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 7 may represent one device or a plurality of devices as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 709, or installed from storage 708, or installed from ROM 702. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 701. It should be noted that, the computer readable medium according to the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In an embodiment of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. Whereas in embodiments of the present disclosure, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: in response to receiving a request to start a process of a target application, starting a data acquisition service process; the process of the target application sends an acquisition request to a data acquisition service process; the data acquisition service process sends the equipment information of the android terminal to a server; the data acquisition service process receives the equipment identification returned by the server and returns the equipment identification to the process of the target application. Or cause the electronic device to: generating a device identifier according to the device information in response to receiving the device information of the android terminal; and sending the device identifier to the android terminal.
Computer program code for carrying out operations of embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments described in the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes a startup unit, an acquisition unit, a transmission unit, and a reception unit. Where the names of these units do not constitute a limitation of the unit itself in some cases, for example, the starting unit may also be described as "a unit that starts a data acquisition service process in response to receiving a request to start a process of a target application".
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention referred to in this disclosure is not limited to the specific combination of features described above, but encompasses other embodiments in which any combination of features described above or their equivalents is contemplated without departing from the inventive concepts described. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).