Information acquisition method and device, electronic equipment and medium
By using the reflection mechanism to obtain the IMS module registration result callback method in SMS application, SIM card number information is extracted, and the problem of high cost of obtaining SIM card number information in the prior art is solved, and low-cost information acquisition is achieved.
Patent Information
- Application Number
- CN202411833125.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, the method of obtaining SIM card number information installed in electronic devices is relatively expensive and requires improvements to the framework layer.
By using the reflection mechanism in the SMS application, the registration result callback method of the IP multimedia subsystem IMS module is obtained from the framework layer, and the registration result information, including SIM card number information, is extracted through preset classes and listening methods.
It realizes the acquisition of SIM card number information at low cost in the application layer of electronic devices, without the cost consumption of SMS sending and receiving, and no improvement to the framework layer is required, saving tariff costs and improvement costs.
Smart Images

Figure CN119729447A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of electronic equipment, and specifically relates to an information acquisition method, device, electronic equipment and medium. Background Art
[0002] Currently, all electronic devices support system-level push services, which generally push messages to user devices based on the unique identifier of the electronic device. At present, the push messages received by user devices are actually pushed by the service providers of each push message based on the unique identifier of the electronic device. Before the service providers of each push message push messages based on the unique identifier of the electronic device, the electronic device needs to establish a correspondence between the unique identifier of the electronic device and the subscriber identification module (SIM) card number installed in the electronic device in advance.
[0003] Before establishing a correspondence between a unique identifier of an electronic device and a SIM card number installed in the electronic device, the number of the SIM card installed in the electronic device must first be obtained. However, currently, the method of obtaining the number of the SIM card installed in the electronic device is costly. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an information acquisition method, device, electronic device and medium, which can acquire the number information of a SIM card installed in an electronic device at a low cost.
[0005] In a first aspect, an embodiment of the present application provides an information acquisition method, the method comprising:
[0006] Based on the SMS application, a reflection mechanism is used to obtain an IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer, wherein the IMS registration result callback method includes a preset class, the preset class includes the registration result information of the IMS service, and the preset class includes a monitoring method, and the monitoring method is used to extract the registration result information from the preset class;
[0007] Based on the monitoring method, extracting the registration result information from the preset category, wherein the registration result information includes the number information of the SIM card;
[0008] Based on the registration result information, the number information of the SIM card is obtained.
[0009] In a second aspect, an embodiment of the present application provides an information acquisition device, the device comprising:
[0010] A first acquisition module is used to obtain an IMS registration result callback method corresponding to an IP multimedia subsystem IMS module from a framework layer by using a reflection mechanism based on a short message application, wherein the IMS registration result callback method includes a preset class, the preset class includes the registration result information of the IMS service, the preset class includes a monitoring method, and the monitoring method is used to extract the registration result information from the preset class;
[0011] A first extraction module, configured to extract the registration result information from the preset category based on the monitoring method, wherein the registration result information includes the number information of the SIM card;
[0012] The first determining module is used to obtain the number information of the SIM card based on the registration result information.
[0013] In a third aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0016] In an embodiment of the present application, a registration result callback method corresponding to the IP multimedia subsystem module in the framework layer is reflectively called in the SMS application based on a reflection mechanism. The preset class of the registration result callback method includes registration result information of the IP multimedia subsystem service. The registration result information of the IP multimedia subsystem service fed back to the framework layer is monitored through a monitoring method in the preset class for monitoring the registration result information. The SMS application can obtain the registration result information of the IP multimedia subsystem service, and then obtain the number information of the SIM card based on the registration result information. In this way, the number information of the SIM card can be obtained in the application layer of the electronic device without the need to consume SMS sending and receiving charges or improve the framework layer, thereby saving the tariff cost and the cost of improving the framework layer, and achieving the effect of obtaining the number information of the SIM card installed in the electronic device at a low cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flowchart of an information acquisition method provided by some embodiments of the present application;
[0018] Figure 2 is a flowchart of an information acquisition method provided by some embodiments of the present application;
[0019] Figure 3 is a schematic diagram of the structure of an information acquisition device shown in some embodiments of the present application;
[0020] Figure 4 is a schematic diagram of the structure of an electronic device shown in some embodiments of the present application;
[0021] Figure 5 It is a schematic diagram of the hardware structure of an electronic device shown in some embodiments of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0023] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or N. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0024] Before introducing the technical solution of the embodiment of the present application, the background technology of the embodiment of the present application is first introduced:
[0025] Currently, the application layer of electronic devices obtains the number information of the SIM card installed in the electronic device in the following ways:
[0026] 1. After installing the SIM card in an electronic device, use the electronic device to actively send specific content to a specific mobile phone number. The service provider corresponding to the specific mobile phone number can obtain the number information where the SIM card is installed.
[0027] 2. The service provider (SP) sends specific SMS content to the electronic device. The SMS application encrypts the SMS content and sends a receipt to the SP to match the SIM card number with the device identifier of the electronic device.
[0028] 3. Using the operating system of the electronic device to call the interface function of the native interface, the SIM card number can be obtained based on the interface function.
[0029] 4. After the electronic device registers the IP Multimedia Subsystem (IMS) service, the registration result information of the IMS service will be fed back to the framework layer of the electronic device. The registration result information of the IMS service will include the SIM card number information, so the SIM card number can be obtained based on the interface of the framework layer.
[0030] Among the above methods of obtaining the SIM card number, the first and second methods have no specific requirements for the chip type and chip version of the electronic device, but the process of sending and receiving text messages will incur higher tariff costs. The third method is only supported by chip version 13 and above. The fourth method requires the original equipment manufacturer (OEM) to improve the framework layer structure, because the existing framework layer can only temporarily receive the registration result information of the IMS service, and there is no way to store the registration result information of the IMS service. Therefore, the framework layer structure needs to be improved, and the registration result information of the IMS service needs to be saved to the framework layer specific interface for the application layer to call, but the cost of improving the framework layer structure is high.
[0031] In summary, the existing method of obtaining the number of the SIM card installed in the device is relatively costly. In order to solve this problem, the embodiments of the present application provide an information acquisition method, device, electronic device and medium. Based on the reflection mechanism, the registration result callback method corresponding to the IP multimedia subsystem module in the framework layer is reflectively called in the SMS application. The preset class of the registration result callback method includes the registration result information of the IP multimedia subsystem service. The registration result information of the IP multimedia subsystem service fed back to the framework layer is monitored by the monitoring method for monitoring the registration result information of the IP multimedia subsystem service in the preset class, so that the SMS application can obtain the registration result information of the IP multimedia subsystem service, and then obtain the number information of the SIM card based on the registration result information. In this way, the number information of the SIM card can be obtained in the application layer of the electronic device without the need for SMS sending and receiving charges or improvements to the framework layer, thereby saving the tariff cost and the improvement cost of the framework layer, and achieving the effect of obtaining the number information of the SIM card installed in the electronic device at a low cost.
[0032] Before introducing the solution of the embodiment of the present application, the professional terms involved in the embodiment of the present application are first introduced:
[0033] IMS module: It is a module used to support IP multimedia subsystem functions. IMS is a technology used to support IP multimedia services such as high-definition voice calls (Voice over LTE, VoLTE) and high-definition video calls (Video over LTE, ViLTE). The IMS module provides a set of classes and interfaces for managing IMS functions on the Android platform, including calls, call processing, messaging, etc.
[0034] IMS service registration: In the communication network, IMS service registration is the basic step for electronic devices to access the network and communicate.
[0035] Sub Id: the index of the SIM card in the electronic device. Each different SIM card in each electronic device has only one Sub Id. The Sub Id here corresponds to the identity (identity, ID) of the card slot used to place the SIM card in the electronic device.
[0036] Reflection mechanism: a mechanism that enables a program to dynamically access class properties and methods. In the embodiment of the present application, it is used for SMS applications to call classes and methods within the framework layer across modules.
[0037] The technical solution of the embodiment of the present application can be applied to the scenario of obtaining the SIM card number of an electronic device with a lower version of Android system, where the lower version of Android system can be an Android system of version 8.0-12.0. This is because electronic devices with an Android system higher than version 12.0 can obtain the SIM card number by relying on the third method in the background technology.
[0038] The information acquisition method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0039] Figure 1 It is a flow chart of an information acquisition method provided in an embodiment of the present application. The executor of the information acquisition method may be an electronic device, which may be but is not limited to a personal computer (PC), a smart phone, a tablet computer or a personal digital assistant (PDA).
[0040] It should be noted that the operating system of the electronic device in the embodiment of the present application is a first operating system within a preset version range, where the preset version range may be a version range of 8.0-12.0, and the first operating system may be an Android operating system.
[0041] like Figure 1 As shown, the information acquisition method provided in the embodiment of the present application may include steps 110 to 130.
[0042] Step 110: Based on the SMS application, the reflection mechanism is used to obtain the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer.
[0043] The IMS registration result callback method may be a method for calling back the registration result of the IMS service.
[0044] For different versions of the operating system, the IMS registration result callback method is different. For example, for versions 11-12 of the operating system, the IMS registration result callback method can be the addRegistrationCallback(RegistrationManager.RegistrationCallback callback) method in the ImsManager class. For version 10.0 of the operating system, the IMS registration result callback method can be the addRegistrationCallback(ImsMmTelManager.RegistrationCallback callback) method in the ImsManager class. For version 9.0 of the operating system, the IMS registration result callback method can be the addRegistrationCallback(android.telephony.ims.stub.ImsRegistrationImplBase.Call back callback) method in the ImsManager class. For version 8.1 of the operating system, the IMS registration result callback method can be the addRegistrationListener(com.android.ims.ImsConnectionStateListenerlistener) method in the ImsManager class.
[0045] In order to more conveniently understand the IMS registration result callback method of the electronic device reflection call of each version, refer to Table 1, which shows the IMS registration result callback method of the electronic device reflection call of each version:
[0046] Table 1
[0047]
[0048]
[0049] The above-mentioned IMS registration result callback method may include a preset class, such as the ImsConnectionStateListener class, which may include the registration result information of the IMS service, and the registration result information may include the number information of the SIM card.
[0050] The registration result information of the IMS service may be fed back to the preset category through the operation server when the IMS service registration is completed. The specific registration process of the IMS service will be described in detail in the following embodiments.
[0051] The above preset class may include a monitoring method, and the monitoring method may be used to extract registration result information from the preset class.
[0052] It should be noted that the SMS application is in the application layer of the electronic device, that is, the method of the embodiment of the present application is applied in the application layer of the electronic device.
[0053] In some embodiments of the present application, when the SMS application uses the reflection mechanism to obtain the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer, it is necessary to determine that the SMS application is in the startup state. The specific trigger for the SMS application startup may be the powering on of the electronic device or the change in the insertion and removal status of the SIM card.
[0054] In some embodiments of the present application, before step 110, the above method may further include:
[0055] When it is determined that the SMS application receives the preset broadcast, a registration request for the IMS service is sent to the operator server, so that the operator server registers the IMS service based on the registration request and feeds back the registration result information of the IMS service to the preset class.
[0056] The preset broadcast may include any of the following: a power-on broadcast or a broadcast of a change in the insertion and removal status of a SIM card.
[0057] The registration request may be a request sent by the electronic device to the operator server to request registration for the IMS service.
[0058] In some embodiments of the present application, when the SMS application receives a preset broadcast, it can send a registration request for the IMS service to the operator server. After receiving the registration request, the operator server can register the IMS service based on the registration request and feed back the registration result information of the IMS service to the preset class.
[0059] It should be noted that the IMS registration result callback method includes multiple classes. When the operator server feeds back the registration result information of the IMS service to the IMS registration result callback method, the specific class to which it is fed back can be set according to the needs, and is not limited in the embodiments of the present application. For example, the operator server may randomly feed back the registration result information of the IMS service to a class in the IMS registration result callback method. After the operator server randomly feeds back the registration result information of the IMS service to a class in the IMS registration result callback method, the registration result information of the IMS service may be fed back to the electronic device in which class of the IMS registration result callback method the registration result information of the IMS service is fed back, so that the subsequent electronic device can obtain the registration result information based on the class.
[0060] In the fourth method of obtaining the number information of the SIM card in the prior art, in the 12.0 version of the electronic device, the registration result information of the IMS service is fed back to the ImsConnectionStateListener class of the electronic device. Referring to the prior art, the preset class in the embodiment of the present application selects the ImsConnectionStateListener class.
[0061] In an embodiment of the present application, when it is determined that the SMS application has received a preset broadcast, a registration request for the IMS service can be sent to the operator server, so that the operator server registers the IMS service based on the registration request, and feeds back the registration result information of the IMS service to the preset class. In this way, the SMS application of the electronic device can obtain the SIM card number information through the IMS registration result callback method containing the preset class that is reflected and called.
[0062] In some embodiments of the present application, in order to improve the flexibility of the preset broadcast received by the electronic device, the determining that the SMS application receives the preset broadcast may include:
[0063] When the chip type of the electronic device is the first type, when it is detected that the electronic device is restarted or the plug-in status of the SIM card is updated, determining that the SMS application of the electronic device has received a power-on broadcast or a SIM card plug-in status change broadcast;
[0064] When the chip type of the electronic device is the second type, when it is detected that the electronic device is restarted, it is determined that the SMS application of the electronic device has received the power-on broadcast.
[0065] The first type and the second type may be two types of chips of the electronic device, and the developers of the specific first type of chip and the second type of chip are different.
[0066] In some embodiments of the present application, for an electronic device with a chip type of the first type, when it is detected that the electronic device is restarted or the insertion and removal status of the SIM card is updated, it is determined that the SMS application of the electronic device has received a power-on broadcast or a SIM card insertion and removal status change broadcast.
[0067] For the electronic device whose chip type is the second type, when it is detected that the electronic device is restarted, it is determined that the SMS application of the electronic device has received the startup broadcast.
[0068] In the embodiments of the present application, electronic devices with different chip types receive different preset broadcasts, which improves the flexibility of the preset broadcasts received by the electronic devices.
[0069] In some embodiments of the present application, for electronic devices with different operating systems and different chip types, the timing of executing step 110 is different. In order to improve the flexibility of the reflective call IMS registration result callback method, step 110 may specifically include:
[0070] When the version of the operating system of the electronic device is the first version, the chip type of the electronic device is the first type, and the interface registration of the IMS module is completed, the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module is obtained from the framework layer based on the SMS application by using the reflection mechanism;
[0071] When the chip type of the electronic device is the second type and it is determined that the SMS application receives the preset broadcast, the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module is obtained from the framework layer by using the reflection mechanism based on the SMS application.
[0072] Among them, the first version may be version 8.1.
[0073] It should be noted that the registration of the interface of the IMS module can be completed when the manufacturer produces the interface of the IMS module.
[0074] In some embodiments of the present application, the timing of reflectively calling the IMS registration result callback method is different for electronic devices of different versions. Specifically, for electronic devices with a chip type of the second type and an operating system version of 9.0-12.0, the IMS registration result callback method is reflectively called when registering for the IMS service, while for electronic devices with a chip type of the first type and an operating system version of 8.0, the IMS registration result callback method can be reflectively called when registering the IMS interface, without waiting until the device is turned on or the SIM card is inserted or removed.
[0075] That is, when the version of the operating system of the electronic device is the first version, and the chip type of the electronic device is the first type, and the interface registration of the IMS module is completed, the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module can be obtained from the framework layer based on the SMS application using the reflection mechanism. When the chip type of the electronic device is the second type, and when it is determined that the SMS application receives the preset broadcast, the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module can be obtained from the framework layer based on the SMS application using the reflection mechanism.
[0076] It should be noted that, when it is determined that the SMS application receives the preset broadcast, the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module can be obtained from the framework layer based on the SMS application using the reflection mechanism, and at the same time, the IMS service also starts to register. The specific registration process of the IMS service will be described in detail in the subsequent embodiments. In addition, in order for the SMS application to receive the preset broadcast, the electronic device needs to agree to the user agreement in advance.
[0077] It should be noted that, for electronic devices whose chip type is the first type and whose operating system version is 8.0, the timing for reflectively calling the IMS registration result callback method may be when registering the IMS interface, but in actual applications, the IMS registration result callback method may not be reflectively called when registering the IMS interface, but may be reflectively called when the SMS application receives a preset broadcast, because in actual applications, if it is not for obtaining the SIM card number information, the reflective call of the IMS registration result callback method has no other additional function. Therefore, in order to save computing resources, for electronic devices whose chip type is the first type and whose operating system version is 8.0, the IMS registration result callback method may also be reflectively called when the SMS application receives a preset broadcast.
[0078] In an embodiment of the present application, depending on the chip type and operating system version of the electronic device, the IMS registration result callback method corresponding to the IMS module can be obtained from the framework layer based on the SMS application using the reflection mechanism at different times, thereby improving the reflection calling flexibility of the IMS registration result callback method.
[0079] In some embodiments of the present application, the preset class and the monitoring method under the preset class in the IMS registration result callback method in the framework layer are not used to monitor the registration result information of the IMS service in the framework layer. In order to enable the preset class and the monitoring method under the preset class in the IMS registration result callback method to be used for monitoring the registration result information of the IMS service in the SMS application, it is necessary to rewrite the preset class and the monitoring method under the preset class in the IMS registration result callback method in the SMS application. The rewriting here can be understood as redefining the role of the preset class and the monitoring method under the preset class in the IMS registration result callback method.
[0080] The above-mentioned method of redefining the role of the preset class and the monitoring method under the preset class in the IMS registration result callback method can be: writing program code to define the role of the preset class and the monitoring method under the preset class in the IMS registration result callback method, and then compiling the written program code, so that the preset class and the monitoring method under the preset class in the IMS registration result callback method can be used in the SMS application to monitor the registration result information of the IMS service.
[0081] That is, after step 110, the above method may further include:
[0082] The preset class and the monitoring method under the preset class are rewritten in the SMS application, so that the monitoring method under the preset class is used to extract registration result information from the preset class.
[0083] In some embodiments of the present application, the preset class and the monitoring method under the preset class can be overwritten in the SMS application, so that the monitoring method under the preset class is used to extract registration result information from the preset class, so that the registration result information can be subsequently obtained in the SMS application based on the monitoring method.
[0084] It should be noted that rewriting the preset class in the SMS application and the monitoring method under the preset class can be performed before step 110 or after step 110, which is not limited in the embodiment of the present application. However, if the preset class is rewritten in the SMS application and the monitoring method under the preset class is performed before step 110, the electronic device needs to clarify which class the registration result information is in in the IMS registration result callback method.
[0085] In an embodiment of the present application, by rewriting the preset class and the monitoring method under the preset class in the SMS application, the monitoring method under the preset class can be used to extract registration result information from the preset class, and then the SIM card number information can be obtained in the SMS application.
[0086] Before step 110, the above method may further include:
[0087] The authority control method corresponding to the IMS module in the framework layer is called based on the reflection mechanism, so as to filter and execute the authority calling process involved in the IMS registration result callback method based on the authority control method.
[0088] The authority control method may be a method for controlling the authority involved in the IMS registration result callback method corresponding to the IMS module in the framework layer.
[0089] In some embodiments of the present application, when the version of the electronic device's operating system is version 8.1, the SMS application in the operating system of the electronic device uses the reflection mechanism to obtain the IMS registration result callback method corresponding to the IMS module from the framework layer. The IMS registration result callback method contains a process that requires calling other permissions of the electronic device. However, in the scheme of the embodiment of the present application, there is no need to call other permissions of the electronic device. Therefore, in order to avoid the problem of permission missing exception when executing the part that requires calling other permissions during the execution of the IMS registration result callback method, the permission control method corresponding to the IMS module in the framework layer is called based on the reflection mechanism. Based on the permission control method, the part that requires calling other permissions can be bypassed during the execution of the IMS registration result callback method. That is, based on the permission control method, the permission calling process involved in the IMS registration result callback method can be filtered and executed, so that the problem of permission missing exception will not occur.
[0090] The permission control method called above can be calling the unregisterBroadcastReceiver method in the com.android.ims.ImsManager class, and filtering and executing the permission calling process involved in the IMS registration result callback method based on the unregisterBroadcastReceiver method. This can avoid the com.mediatek.ims.config.provider.PERMISSION.WRITE permission missing exception during the execution of the IMS registration result callback method corresponding to the IMS module obtained from the framework layer by the SMS application using the reflection mechanism.
[0091] In an embodiment of the present application, before obtaining the IMS registration result callback method corresponding to the IMS module from the framework layer based on the SMS application using the reflection mechanism, the corresponding permission control method of the IMS module in the framework layer is called based on the reflection mechanism, so as to filter and execute the permission calling process involved in the IMS registration result callback method based on the permission control method. In this way, the electronic device of the first version of the operating system can avoid the abnormal situation of missing permissions when executing the IMS registration result callback method, ensure the normal execution of the SMS application reflective call of the IMS registration result callback method, and then obtain the number information of the SIM card.
[0092] Step 120: Extract registration result information from the preset class based on the monitoring method.
[0093] In some embodiments of the present application, since the monitoring method is rewritten in the IMS registration result callback method, the registration result information can be directly extracted from the preset class based on the monitoring method.
[0094] It should be noted that since the communication framework process may not have been started after the electronic device is turned on, the SMS application's reflective call to the IMS registration result callback method fails. Therefore, it is necessary to reflectively call the IMS registration result callback method again after 1-3s after the failure of the reflective call to the IMS registration result callback method. Repeat this multiple times to monitor the registration result information of the IMS service.
[0095] In order to facilitate a better understanding of the registration result information, the following Tables 2 and 3 show the time for each version of the electronic device with different chip types to reflect the callback of the IMS registration result callback method, and the format of the registration result information of the IMS service monitored and fed back to the framework layer. Specifically, Table 2 shows the time for each version of the electronic device with the chip type of the first type to reflect the callback of the IMS registration result callback method, and the format of the registration result information of the IMS service monitored and fed back to the framework layer. Table 3 shows the time for each version of the electronic device with the chip type of the second type to reflect the callback of the IMS registration result callback method, and the format of the registration result information of the IMS service monitored and fed back to the framework layer.
[0096] Table 2
[0097] Android version Callback timing Registration result information format 11 When registering ims +8618805199037 10 When registering ims +8618805199037 9 When registering ims +8618805199037 8.1 Callback when registering the interface +8618805199037
[0098] Table 3
[0099]
[0100] Step 130: Based on the registration result information, obtain the number information of the SIM card.
[0101] In some embodiments of the present application, since the registration result information includes the number information of the SIM card, the specific format of the registration result information may be as shown in Table 2 and Table 3 above, so that the number information of the SIM card can be obtained based on the registration result information.
[0102] In some embodiments of the present application, the formats of the registration result information monitored by the electronic device are different due to different chip types. Therefore, different parsing methods can be used to obtain the number information of the SIM card from the registration result information according to different chip types. In order to improve the flexibility of obtaining the number information of the SIM card, step 130 can specifically include:
[0103] When the chip type of the electronic device is the second type, the number information of the SIM card in the registration result information is extracted using a regular expression to obtain the number information of the SIM card.
[0104] In some embodiments of the present application, when the chip type of the electronic device is the first type, as shown in Table 2, the registration result information directly contains the number information of the SIM card, so the number information of the SIM card can be directly obtained from the registration result information.
[0105] When the chip type of the electronic device is the second type, as shown in Table 3, the registration result information contains the number information of the SIM card and other information, so it is necessary to extract the number information of the SIM card in the registration result information. Specifically, the number information of the SIM card in the registration result information can be extracted based on a regular expression, so that the number information of the SIM card can be obtained.
[0106] It should be noted that when the chip type of the electronic device is the second type, the meaning of each information in the registration result information is as follows: Take the registration result information corresponding to version 11.0 of the electronic device: sip:+8618805199037@js.ims.mnc000.mcc460.3gpnetwork.org as an example, where "sip:" is the protocol header, "+8618805199037" is the SIM card number information, and "@js.ims.mnc000.mcc460.3gpnetwork.org" is the protocol tail.
[0107] In the embodiment of the present application, different parsing methods are used to obtain the number information of the SIM card from the registration result information according to different chip types, thereby improving the flexibility of obtaining the number information of the SIM card.
[0108] In some embodiments of the present application, after the IMS registration result callback method is reflected and called, the state of the IMS registration result callback method is changed. If the state of the IMS registration result callback method is not changed back, the use of the subsequent communication framework layer may be affected. Therefore, in order not to affect the use of the subsequent communication framework layer, after step 130, the above-mentioned method may also include:
[0109] The deregistration method of the IMS registration result callback method is reflectively called based on the reflection mechanism, so that the IMS registration result callback method is rolled back to an initial state.
[0110] The deregistration method may be a method for deregistering the IMS registration result callback method, and the deregistration method may cause the IMS registration result callback method to return to an initial state.
[0111] The initial state may be a state before the IMS registration result callback method is reflectively called by the SMS application.
[0112] In some embodiments of the present application, as shown in Table 1 above, different versions of electronic devices have different corresponding IMS registration result callback methods, so the deregistration methods of the corresponding IMS registration result callback methods are also different, as shown in Table 1 above.
[0113] In some embodiments of the present application, the removeRegistrationListener method of the ImsManager class may be reflectively called to avoid affecting subsequent communication framework processes.
[0114] In an embodiment of the present application, a deregistration method of the IMS registration result callback method is reflectively called based on a reflection mechanism, so that the IMS registration result callback method can be rolled back to an initial state, thereby avoiding affecting subsequent communication framework processes.
[0115] In some embodiments of the present application, different SIM cards in each electronic device have only one card slot Sub Id. After obtaining the number information of the SIM card, it needs to be stored in the electronic device. When storing, it is necessary to record the correspondence between the number information of the SIM card and the Sub Id at the same time, that is, save the number information corresponding to each card slot in the device.
[0116] It should be noted that when storing the number information of the SIM card, the location where the number information of the SIM card is stored is different depending on the screen state of the electronic device, that is, after step 150, the above method may further include:
[0117] According to the screen status of the electronic device, the number information of the SIM card is stored in the target storage location.
[0118] Among them, the screen status of the electronic device can be whether the screen of the electronic device is turned on or off, specifically whether the screen of the electronic device is in a locked state or an unlocked state.
[0119] The above-mentioned lock screen state may be that the user has not entered the lock screen password, that is, the electronic device has not entered the desktop of the electronic device. The unlocked screen state may be that the lock screen password is entered, the electronic device screen is turned on, and the desktop of the electronic device is displayed.
[0120] The target storage location may be location information where the number information of the SIM card is stored according to the screen state of the electronic device.
[0121] In some embodiments of the present application, when the screen of the electronic device is in the locked state, the electronic device is in the file encryption (File-Based Encryption, FBE) mode. In this state, files cannot be written to the data / data directory, so the SIM card number information needs to be saved in the DE (data / user_de / 0) directory. If the electronic device is in the unlocked state, the SIM card number information can be saved in the data / data directory.
[0122] In the embodiments of the present application, the number information of the SIM card can be stored in different storage locations of the electronic device according to the screen status of the electronic device, thereby improving the flexibility of the storage location of the number information of the SIM card.
[0123] In some embodiments of the present application, after obtaining the number information of the SIM card, the number information of the SIM card and the device identification of the electronic device can be uploaded to a server, such as a server of the electronic device, and the correspondence between the number information of the SIM card and the device identification of the electronic device can be obtained, so that a message can be pushed to the electronic device based on the correspondence.
[0124] In order to better understand the solution of the embodiment of the present application, the solution of the embodiment of the present application is now explained with a specific scenario.
[0125] like Figure 2 As shown, the information acquisition method provided in the embodiment of the present application may include steps 201 to 212.
[0126] Step 201, determine the chip type of the electronic device, if it is the first type, execute step 202, if it is the second type, execute step 203.
[0127] Step 202: When the electronic device is turned on or the plug-in / plug-out status of the SIM card changes, the electronic device issues a broadcast of the power-on or plug-in / plug-out status change of the SIM card.
[0128] When the chip type of the electronic device is the first type, after the electronic device sends a power-on broadcast or a SIM card insertion and removal status change broadcast, the SMS application is started and can receive the power-on broadcast or the SIM card insertion and removal status change broadcast.
[0129] Step 203: After the power-on is completed, the electronic device sends a power-on broadcast.
[0130] In the case that the chip type of the electronic device is the second type, after the electronic device sends out the power-on broadcast, the SMS application is started, and the SMS application can receive the power-on broadcast.
[0131] After the electronic device sends a power-on broadcast or a SIM card insertion and removal status change broadcast, the electronic device performs the IMS service registration process. After the IMS service registration is completed, the IMS service registration result information can be fed back to the preset class of the framework layer IMS registration result callback method.
[0132] Step 204 , determine whether the version of the operating system of the electronic device is equal to the first version, if so, execute step 205 , if not, execute step 206 .
[0133] Step 205: reflectively call the permission control method corresponding to the IMS module in the framework layer.
[0134] In step 205, by reflectively calling the authority control method corresponding to the IMS module in the framework layer, the authority missing exception problem during the execution of the IMS registration result callback method can be avoided.
[0135] Step 206: Based on the SMS application, the reflection mechanism is used to obtain the IMS registration result callback method corresponding to the IMS module from the framework layer.
[0136] After step 206, it can be determined whether the IMS registration result callback method is reflectively called successfully. If so, step 207 is executed. If not, step 206 is executed again after waiting for 1-3 seconds.
[0137] Step 207: rewrite the preset class in the IMS registration result callback method and the monitoring method under the preset class in the SMS application.
[0138] Step 208: Monitor the registration result information of the IMS service based on the monitoring method in the IMS registration result callback method.
[0139] Step 209: Based on the registration result information, obtain the number information of the SIM card.
[0140] The above steps 208 to 209 are consistent with steps 120 to 130 in the above embodiment and will not be described in detail here.
[0141] Step 210: A deregistration method is implemented by reflectively calling an IMS registration result callback method based on a reflection mechanism.
[0142] Step 211: Save the number information of the SIM card to a target storage location.
[0143] In step 211, the number information of the SIM card can be saved to a target storage location according to the screen status of the electronic device. The specific implementation method can refer to the above embodiment and will not be described in detail here.
[0144] Step 212: Upload the number information of the SIM card and the device identification of the electronic device to the server.
[0145] The method provided in the embodiment of the present application can reduce the cost of obtaining SIM card number information, and has high acquisition accuracy, covers a wide range of electronic devices, and has high application value.
[0146] The information acquisition method provided in the embodiment of the present application can be executed by an information acquisition device. In the embodiment of the present application, the information acquisition device provided in the embodiment of the present application is described by taking the information acquisition method executed by the information acquisition device as an example.
[0147] Figure 3 FIG. 1 is a schematic diagram showing a structure of an information acquisition device according to an exemplary embodiment. The information acquisition device can be applied to electronic devices such as Figure 3 As shown, the information acquisition device 300 may include:
[0148] A first acquisition module 310 is used to obtain an IMS registration result callback method corresponding to an IP multimedia subsystem IMS module from a framework layer by using a reflection mechanism based on a short message application, wherein the IMS registration result callback method includes a preset class, the preset class includes the registration result information of the IMS service, the preset class includes a monitoring method, and the monitoring method is used to extract the registration result information from the preset class;
[0149] A first extraction module 320, configured to extract the registration result information from the preset category based on the monitoring method, wherein the registration result information includes the number information of the SIM card;
[0150] The first determining module 330 is configured to obtain the number information of the SIM card based on the registration result information.
[0151] In an embodiment of the present application, a registration result callback method corresponding to the IP multimedia subsystem module in the framework layer is reflectively called in the SMS application based on the reflection mechanism. The preset class of the registration result callback method includes the registration result information of the IP multimedia subsystem service. The registration result information of the IP multimedia subsystem service fed back to the framework layer is monitored through the monitoring method for monitoring the registration result information in the preset class, so that the SMS application can obtain the registration result information of the IP multimedia subsystem service, and then obtain the SIM card number information based on the registration result information. In this way, the SIM card number information can be obtained in the application layer of the electronic device without the need to consume the SMS sending and receiving charges, and without improving the framework layer, thereby saving the tariff cost and the improvement cost of the framework layer, and achieving the effect of low-cost acquisition of the number information of the SIM card installed in the electronic device.
[0152] In some embodiments of the present application, the above-mentioned device may further include:
[0153] A rewriting module is used to rewrite the preset class and the monitoring method under the preset class in the SMS application after the SMS application obtains the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer using the reflection mechanism, so that the monitoring method under the preset class is used to extract the registration result information from the preset class.
[0154] In some embodiments of the present application, the above-mentioned device may further include:
[0155] A sending module is used to send a registration request for the IMS service to the operator server before the SMS application obtains the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer using the reflection mechanism, when it is determined that the SMS application has received a preset broadcast, so that the operator server registers the IMS service based on the registration request and feeds back the registration result information of the IMS service to the preset class.
[0156] In some embodiments of the present application, the preset broadcast includes any one of the following: a power-on broadcast, a broadcast of a change in the insertion and removal status of the SIM card;
[0157] The sending module may include:
[0158] A first determining unit is used to determine, when the chip type of the electronic device is the first type, whether the SMS application of the electronic device has received a power-on broadcast or a broadcast of a change in the insertion and removal status of the SIM card when it is detected that the electronic device is restarted or the insertion and removal status of the SIM card is updated;
[0159] The second determination unit is used to determine that the SMS application of the electronic device has received a power-on broadcast when the chip type of the electronic device is the second type and when it is detected that the electronic device is restarted; wherein the developers of the first type of chip and the second type of chip are different.
[0160] In some embodiments of the present application, when the version of the operating system of the electronic device is the first version, the above-mentioned apparatus may further include:
[0161] The second acquisition module is used to call the permission control method corresponding to the IMS module in the framework layer based on the reflection mechanism before obtaining the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer based on the SMS application using the reflection mechanism, so as to filter and execute the permission calling process involved in the IMS registration result callback method based on the permission control method.
[0162] In some embodiments of the present application, the above-mentioned device may further include:
[0163] The third acquisition module is used to reflectively call the de-registration method of the IMS registration result callback method based on the reflection mechanism after obtaining the number information of the SIM card based on the registration result information, so as to make the IMS registration result callback method fall back to the initial state.
[0164] In some embodiments of the present application, the above-mentioned device may further include:
[0165] The storage module is used to store the number information of the SIM card in a target storage location according to the screen state of the electronic device after obtaining the number information of the SIM card based on the registration result information.
[0166] The information acquisition device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or it can be other devices other than the terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application is not specifically limited.
[0167] The information acquisition device in the embodiment of the present application may be a device having an operating system, which may be an Android operating system.
[0168] The information acquisition device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0169] Alternatively, if Figure 4As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401 and a memory 402, wherein the memory 402 stores programs or instructions that can be executed on the processor 401, and when the program or instructions are executed by the processor 401, the various steps of the above-mentioned information acquisition method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0170] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0171] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0172] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510.
[0173] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0174] Among them, the processor 510 is used to obtain the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer based on the SMS application using the reflection mechanism, wherein the IMS registration result callback method includes a preset class, and the preset class includes the registration result information of the IMS service. The preset class includes a monitoring method, and the monitoring method is used to extract the registration result information from the preset class; based on the monitoring method, the registration result information is extracted from the preset class, wherein the registration result information includes the number information of the SIM card; based on the registration result information, the number information of the SIM card is obtained.
[0175] In this way, based on the reflection mechanism, the registration result callback method corresponding to the IP multimedia subsystem module in the framework layer is reflectively called in the SMS application. The preset class of the registration result callback method includes the registration result information of the IP multimedia subsystem service. The registration result information of the IP multimedia subsystem service fed back to the framework layer is monitored through the monitoring method for monitoring the registration result information in the preset class, so that the SMS application can obtain the registration result information of the IP multimedia subsystem service, and then obtain the SIM card number information based on the registration result information. In this way, the SIM card number information can be obtained in the application layer of the electronic device without the need to consume the SMS sending and receiving charges or improve the framework layer, thereby saving the tariff cost and the improvement cost of the framework layer, and achieving the effect of low-cost acquisition of the number information of the SIM card installed in the electronic device.
[0176] Optionally, the processor 510 is also used to rewrite the preset class and the monitoring method under the preset class in the SMS application after the SMS application obtains the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer using the reflection mechanism, so that the monitoring method under the preset class is used to extract the registration result information from the preset class.
[0177] Thus, by overriding the preset class and the monitoring method under the preset class in the SMS application, the monitoring method under the preset class can be used to extract the registration result information from the preset class, and then the SIM card number information can be obtained in the SMS application.
[0178] Optionally, the processor 510 is also used to send a registration request for the IMS service to the operator server before the SMS application obtains the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer using the reflection mechanism, when it is determined that the SMS application has received a preset broadcast, so that the operator server registers the IMS service based on the registration request, and feeds back the registration result information of the IMS service to the preset class.
[0179] In this way, when it is determined that the SMS application has received the preset broadcast, a registration request for the IMS service can be sent to the operator server, so that the operator server registers the IMS service based on the registration request and feeds back the registration result information of the IMS service to the preset class. In this way, the SMS application of the electronic device can obtain the SIM card number information through the IMS registration result callback method containing the preset class that is called by reflection.
[0180] Optionally, the preset broadcast includes any one of the following: a power-on broadcast, a broadcast of a change in the insertion and removal status of the SIM card; the processor 510 is further used to, when the chip type of the electronic device is the first type, determine that the SMS application of the electronic device has received a power-on broadcast or a broadcast of a change in the insertion and removal status of the SIM card when it is detected that the electronic device is restarted or the insertion and removal status of the SIM card is updated; when the chip type of the electronic device is the second type, when it is detected that the electronic device is restarted, determine that the SMS application of the electronic device has received a power-on broadcast; wherein the developers of the first type of chip and the second type of chip are different.
[0181] In this way, electronic devices with different chip types receive different preset broadcasts, which improves the flexibility of the preset broadcasts received by the electronic devices.
[0182] Optionally, the processor 510 is also used to, when the version of the operating system of the electronic device is the first version, call the permission control method corresponding to the IMS module in the framework layer based on the reflection mechanism before the SMS application obtains the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer using the reflection mechanism, so as to control the permissions involved in the IMS registration result callback method based on the permission control method.
[0183] In this way, before the SMS application uses the reflection mechanism to obtain the IMS registration result callback method corresponding to the IMS module from the framework layer, the corresponding permission control method of the IMS module in the framework layer is called based on the reflection mechanism, so as to filter and execute the permission calling process involved in the IMS registration result callback method based on the permission control method. In this way, the electronic device of the first version of the operating system can avoid the abnormal situation of missing permissions when executing the IMS registration result callback method, and ensure the normal execution of the SMS application reflective call to the IMS registration result callback method, so as to obtain the number information of the SIM card.
[0184] Optionally, the processor 510 is further configured to, after obtaining the number information of the SIM card based on the registration result information, reflectively call the de-registration method of the IMS registration result callback method based on a reflection mechanism, so as to return the IMS registration result callback method to an initial state.
[0185] In this way, the deregistration method of the IMS registration result callback method is reflectively called based on the reflection mechanism, so that the IMS registration result callback method can be rolled back to the initial state, thereby avoiding affecting the subsequent communication framework process.
[0186] Optionally, the processor 510 is further configured to store the number information of the SIM card in a target storage location according to a screen state of the electronic device after obtaining the number information of the SIM card based on the registration result information.
[0187] In this way, the number information of the SIM card can be stored in different storage locations of the electronic device according to the screen status of the electronic device, thereby improving the flexibility of the storage location of the number information of the SIM card.
[0188] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or video obtained by the image capture device (such as a color camera) in the video capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and at least one of other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0189] The memory 509 can be used to store software programs and various data. The memory 509 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 509 may include a volatile memory or a non-volatile memory, or the memory 509 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 509 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0190] The processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 510.
[0191] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned information acquisition method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0192] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0193] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned information acquisition method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0194] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0195] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned information acquisition method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0196] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0197] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0198] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for obtaining information, characterized in that: The method is applied to an electronic device, and the method comprises: Based on the SMS application, a reflection mechanism is used to obtain an IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer, wherein the IMS registration result callback method includes a preset class, the preset class includes the registration result information of the IMS service, and the preset class includes a monitoring method, and the monitoring method is used to extract the registration result information from the preset class; Based on the monitoring method, extracting the registration result information from the preset category, wherein the registration result information includes the number information of the SIM card; Based on the registration result information, the number information of the SIM card is obtained.
2. The method according to claim 1, characterized in that After the SMS application uses the reflection mechanism to obtain the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer, the method further includes: The preset class and the monitoring method under the preset class are rewritten in the SMS application, so that the monitoring method under the preset class is used to extract the registration result information from the preset class.
3. The method according to claim 1, characterized in that Before the SMS application uses the reflection mechanism to obtain the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer, the method further includes: When it is determined that the SMS application receives the preset broadcast, a registration request for the IMS service is sent to the operator server, so that the operator server registers the IMS service based on the registration request and feeds back the registration result information of the IMS service to the preset class.
4. The method according to claim 3, characterized in that The preset broadcast includes any one of the following: a power-on broadcast, a broadcast of a change in the insertion and removal status of the SIM card; The determining that the SMS application receives a preset broadcast includes: In the case where the chip type of the electronic device is the first type, when it is detected that the electronic device is restarted or the plugging and unplugging status of the SIM card is updated, determining that the SMS application of the electronic device has received a power-on broadcast or a plugging and unplugging status change broadcast of the SIM card; In the case where the chip type of the electronic device is the second type, when it is detected that the electronic device is restarted, determining that the SMS application of the electronic device has received a startup broadcast; The first type of chip and the second type of chip are from different developers.
5. The method according to claim 1, characterized in that In the case where the version of the operating system of the electronic device is the first version, before the SMS application uses the reflection mechanism to obtain the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer, the method further includes: The authority control method corresponding to the IMS module in the framework layer is called based on the reflection mechanism, so as to filter and execute the authority calling process involved in the IMS registration result callback method based on the authority control method.
6. The method according to claim 1, characterized in that After obtaining the number information of the SIM card based on the registration result information, the method further includes: The deregistration method of the IMS registration result callback method is reflectively called based on the reflection mechanism, so that the IMS registration result callback method is rolled back to an initial state.
7. The method according to claim 1, characterized in that After obtaining the number information of the SIM card based on the registration result information, the method further includes: According to the screen status of the electronic device, the number information of the SIM card is stored in a target storage location.
8. An information acquisition device, characterized in that: The device is applied to electronic equipment, and the device comprises: A first acquisition module is used to obtain an IMS registration result callback method corresponding to an IP multimedia subsystem IMS module from a framework layer by using a reflection mechanism based on a short message application, wherein the IMS registration result callback method includes a preset class, the preset class includes the registration result information of the IMS service, the preset class includes a monitoring method, and the monitoring method is used to extract the registration result information from the preset class; A first extraction module, configured to extract the registration result information from the preset category based on the monitoring method, wherein the registration result information includes the number information of the SIM card; The first determining module is used to obtain the number information of the SIM card based on the registration result information.
9. The device according to claim 8, characterized in that The device also includes: A rewriting module is used to rewrite the preset class and the monitoring method under the preset class in the SMS application after the SMS application obtains the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer using the reflection mechanism, so that the monitoring method under the preset class is used to extract the registration result information from the preset class.
10. The device according to claim 8, characterized in that The device also includes: A sending module is used to send a registration request for the IMS service to the operator server before the SMS application obtains the IMS registration result callback method corresponding to the IP Multimedia Subsystem IMS module from the framework layer using the reflection mechanism, when it is determined that the SMS application has received a preset broadcast, so that the operator server registers the IMS service based on the registration request and feeds back the registration result information of the IMS service to the preset class.
11. The device according to claim 10, characterized in that The preset broadcast includes any one of the following: a power-on broadcast, a broadcast of a change in the insertion and removal status of the SIM card; The sending module comprises: A first determining unit is used to determine, when the chip type of the electronic device is the first type, whether the SMS application of the electronic device has received a power-on broadcast or a broadcast of a change in the insertion and removal status of the SIM card when it is detected that the electronic device is restarted or the insertion and removal status of the SIM card is updated; The second determination unit is used to determine that the SMS application of the electronic device has received a power-on broadcast when the chip type of the electronic device is the second type and when it is detected that the electronic device is restarted; wherein the developers of the first type of chip and the second type of chip are different.
12. The device according to claim 8, characterized in that In a case where the version of the operating system of the electronic device is the first version, the device further includes: The second acquisition module is used to call the permission control method corresponding to the IMS module in the framework layer based on the reflection mechanism before obtaining the IMS registration result callback method corresponding to the IP multimedia subsystem IMS module from the framework layer based on the SMS application using the reflection mechanism, so as to filter and execute the permission calling process involved in the IMS registration result callback method based on the permission control method.
13. The device according to claim 8, characterized in that The device also includes: The third acquisition module is used to reflectively call the de-registration method of the IMS registration result callback method based on the reflection mechanism after obtaining the number information of the SIM card based on the registration result information, so as to make the IMS registration result callback method fall back to the initial state.
14. The device according to claim 8, characterized in that The device also includes: The storage module is used to store the number information of the SIM card in a target storage location according to the screen state of the electronic device after obtaining the number information of the SIM card based on the registration result information.
15. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the information acquisition method according to any one of claims 1 to 7 are implemented.
16. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the information acquisition method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Information acquisition method and apparatus, electronic device, and medium
WO2026124392A1