An APN network application method, device and medium in an Android environment
By building an APN network model and using the Android system to monitor network status changes and generate guidance strategies, the complex problem of private network APN network settings is solved, real-time monitoring and user guidance are achieved, and user experience and data security are improved.
Patent Information
- Application Number
- CN202411741696.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-11-29
AI Technical Summary
In the existing technology, the setting and monitoring of private network APN networks are relatively complicated, affecting the use of mobile data networks, and lack of real-time monitoring and guidance mechanisms.
Build an APN network model, use the broadcast component of the Android system to monitor network status changes, generate a network identifier, and generate a guidance strategy based on the device model to monitor and guide users to switch networks in real time.
It enables real-time monitoring and simplified settings of private APN networks, improving user experience, ensuring data security and reducing the impact on mobile data networks.
Smart Images

Figure CN119402865B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network access, and in particular to an APN network application method, device, and medium in an Android environment. Background Art
[0002] With the advent of the mobile internet era, mobile office applications are becoming increasingly popular. However, for some governments, enterprises, and institutions, finding ways to achieve efficient mobile office work while maintaining internal data security has become a major challenge. Currently, deploying an APN network dedicated line is a relatively secure approach. This approach simply requires deploying servers, databases, and other resources on the intranet, then using a dedicated line provided by the operator to provide mobile access to services and resources.
[0003] However, dedicated APN access requires users to frequently set up their mobile network and configure proxy, port, account, password and other information. It is more complicated to use, and connecting to the private network APN will affect the current use of the mobile data network.
[0004] Therefore, how to conduct real-time monitoring and guidance settings for private APN networks has become an urgent problem to be solved. Summary of the Invention
[0005] The embodiments of the present application provide an APN network application method, device and medium in an Android environment to solve the following technical problem: how to monitor and guide the setting of a private network APN network in real time.
[0006] In the first aspect, an embodiment of the present application provides an APN network application method in an Android environment, the method comprising: constructing an APN network model and accessing a preset application; wherein the application is in an Android environment; determining the device model of the Android device, and sending a permission application based on the device model to complete a dynamic registration mode; constructing a NetworkChangedReceiver based on the broadcast component under the Android system, and monitoring the network status changes of the Android device based on the NetworkChangedReceiver; constructing an Activity parent class NetworkBaseActivity, and obtaining the callback event of the network status change of the Android device based on the preset networkevent interface, and obtaining the current network information of the Android device to generate a network identifier of the Android device; comparing a preset boot set based on the network identifier and the device model to generate a boot strategy; when the application corresponding to the Android device is in the background, reminding the user of the Android device to switch networks.
[0007] In one implementation of the present application, the model of the Android terminal is determined, and a permission application is sent based on the model to complete the dynamic registration mode, specifically including: obtaining the device model of the Android terminal based on the Build class of the Android terminal; wherein the device model includes the manufacturer, code and update version; comparing the preset application information based on the device model to determine the list of system permissions that need to be applied for; dynamically applying for the required permissions based on the ActivityCompat class or ContextCompat class of the Android terminal; when the application is approved, completing the dynamic registration mode.
[0008] In one implementation of the present application, a NetworkChangedReceiver is constructed based on the broadcast component under the Android system, and the network status changes of the Android end are monitored based on the NetworkChangedReceiver, specifically including: calling the broadcast component under the Android system to construct the NetworkChangedReceiver, and setting the broadcast interception intent filter ConnectivityManager.CONNECTIVITY_ACTION in the NetworkChangedReceiver; displaying the NetworkEvent interface based on the NetworkChangedReceiver; registering the NetworkChangedReceiver to the Android end based on dynamic registration to receive the network status changes of the Android end.
[0009] In one implementation of the present application, an Activity parent class NetworkBaseActivity is constructed, and based on a preset NetworkEvent interface, a callback event of a network status change of the Android side is obtained, and the current network information of the Android side is obtained to generate a network identifier of the Android side, specifically including: connecting the NetworkEvent interface based on the Activity parent class NetworkBaseActivity, and obtaining a network change callback event based on the NetworkEvent interface; determining the network connection information based on the network change callback event; generating a network identifier based on the obtained network connection information to reflect the current network status; wherein the network identifier includes WiFi and mobile network.
[0010] In an implementation form of the application, the method further comprises: when the page data is submitted, closing the network identifier and identifying the network status; if the network status is normal, submitting the page data to a preset server; if the network is abnormal or the page data submission fails, submitting the page data to a preset SQLlite database and identifying the page data as to-be-submitted data; and when the network status is normal, uploading the to-be-submitted data in the SQLlite database to the server.
[0011] In an implementation form of the application, the guide strategy is generated according to the network identifier and the model by comparing a preset guide set, specifically comprising: constructing the guide set; wherein the guide set comprises a plurality of guide strategies; when the network identifier changes, searching for a corresponding guide strategy in the guide set according to the current network identifier and the model and displaying the guide strategy; wherein when the network identifier is WiFi, closing the WiFi connection based on a preset WifiManager class and guiding the user to open the mobile network based on the guide strategy; when the network identifier is the mobile network, obtaining all access point information and mobile phone card operator information of the user in the user's mobile phone and judging whether the operator has a special APN access point; if the special APN access point exists, guiding the user to select the corresponding APN based on the guide strategy; and when the APN addition page cannot be jumped to, guiding the user to add a new APN access point based on the guide strategy.
[0012] In an implementation form of the application, when the application corresponding to the Android terminal is in the background, the user of the Android terminal is reminded to switch the network, specifically comprising: connecting a preset Application.ActivityLifecycleCallbacks interface of the Android terminal to listen to the life cycle of all activities; when all activities enter the onPause or onStop state, it is judged that the application has entered the background; the user is reminded to switch to a normal network based on the guide strategy; wherein the normal network comprises WiFi or the mobile network.
[0013] In an implementation form of the application, the method further comprises: when the page enters the visible state callback method, performing NetworkChangedReceiver broadcast registration and generating a guide strategy by comparing the network identifier and the device model with the guide set; and when the page is not in the visible state callback method, canceling the NetworkChangedReceiver broadcast registration.
[0014] In one implementation of the present application, when the application corresponding to the Android end is in the background, the user of the Android end is reminded to switch networks, specifically including: connecting to the Application.ActivityLifecycleCallbacks interface preset on the Android end to monitor the life cycle of all Activities; when all Activities enter the onPause or onStop state, it is determined that the application has entered the background; based on the guidance strategy, the user is reminded to switch to a normal network; wherein, the normal network includes WiFi or mobile network.
[0015] In one implementation of the present application, the method further includes: when the page enters the visible state callback method, performing a NetworkChangedReceiver broadcast registration, and comparing the boot set according to the network identifier and the device model to generate a boot strategy; when the page is no longer in the visible state callback method, canceling the NetworkChangedReceiver broadcast registration.
[0016] In the second aspect, an embodiment of the present application also provides an APN network application device in an Android environment, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can: construct an APN network model and access a preset application; wherein the application is in an Android environment; determine the model of the Android end, and send a permission application based on the model to complete the dynamic registration mode; construct a NetworkChangedReceiver based on the broadcast component under the Android system, and listen to the network status changes of the Android end based on the NetworkChangedReceiver; construct an Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android end based on the preset networkevent interface, and obtain the current network information of the Android end to generate the network identifier of the Android end; compare the preset guidance set according to the network identifier and the model to generate a guidance strategy; when the application corresponding to the Android end is in the background, remind the user of the Android end to switch networks.
[0017] On the third aspect, an embodiment of the present application also provides a non-volatile computer storage medium for an APN network application in an Android environment, storing computer executable instructions, and the computer executable instructions are set to: construct an APN network model and access a preset application; wherein the application is in an Android environment; determine the model of the Android end, and send a permission application based on the model to complete the dynamic registration mode; construct a NetworkChangedReceiver based on the broadcast component under the Android system, and listen to the network status changes of the Android end based on the NetworkChangedReceiver; construct an Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android end based on the preset networkevent interface, and obtain the current network information of the Android end to generate the network identifier of the Android end; compare the preset boot set according to the network identifier and the model to generate a boot strategy; when the application corresponding to the Android end is in the background, remind the user of the Android end that he can switch networks.
[0018] The embodiments of the present application provide an APN network application method, device, and medium in an Android environment, which at least have the following technical effects:
[0019] By building an APN network model and connecting to preset applications in the Android environment, applications can use specific network access points for communication, effectively protecting the data within the application.
[0020] By determining the model of the Android terminal, corresponding permission requests can be sent for different models of devices, thereby completing the dynamic registration mode, improving the compatibility and flexibility of the application, and ensuring that the application can run normally on different models of Android devices and obtain the necessary permissions.
[0021] By using the broadcast component (BroadcastReceiver) under the Android system to build a NetworkChangedReceiver, you can monitor the network status changes on the Android side in real time, so that the application can respond to changes in network status in a timely manner, such as network connection, disconnection, or switching, and perform corresponding processing.
[0022] By constructing the Activity parent class NetworkBaseActivity and obtaining callback events of network status changes based on the preset networkevent interface, the current network information of the Android side can be obtained. This information can be used to generate the network identifier of the Android side, and then used for subsequent network management and optimization.
[0023] Based on the generated network identifier and Android model, and by comparing them with the preset guidance set, a corresponding guidance strategy can be generated. When the corresponding Android application is in the background, if the network status changes or needs to be optimized, the Android user can be reminded to switch networks, which helps to improve the user experience and enables real-time monitoring and guidance settings of the private network APN network. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0025] Figure 1 A flowchart of an APN network application method in an Android environment provided by an embodiment of the present application;
[0026] Figure 2 A schematic diagram of the internal structure of an APN network application device in an Android environment is provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0028] The embodiments of the present application provide an APN network application method, device and medium in an Android environment to solve the following technical problem: how to monitor and guide the setting of a private network APN network in real time.
[0029] The technical solutions proposed in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0030] Figure 1 The present invention provides an APN network application flow chart in an Android environment. Figure 1 As shown, an APN network application method in an Android environment provided by an embodiment of the present application specifically includes the following steps:
[0031] Step 1: Build an APN network model and connect to a preset application; wherein the application is in an Android environment.
[0032] APN network model: used to access preset applications to achieve the effect of APN access. The specific implementation method will be described in detail in the subsequent steps.
[0033] Pre-set applications: These applications are usually internal mobile applications for governments, enterprises, and institutions. Since some internal data must be kept confidential, they cannot be directly exposed to the Internet for use.
[0034] Step 2: Determine the device model of the Android terminal and send a permission application based on the device model to complete the dynamic registration mode.
[0035] First, the Android device model is obtained based on the Android Build class. This device model includes the manufacturer, code, and update version. In Android development, the Build class is a static inner class that contains information about the device build. By accessing various properties of the Build class, such as MANUFACTURER, MODEL, and VERSION.RELEASE, you can obtain the device manufacturer, code, and update version of the Android operating system.
[0036] Furthermore, the preset application information is compared according to the device model to determine the list of system permissions that need to be applied for. Different device models may require different system permissions. For example, some devices may have specific hardware functions (such as NFC, fingerprint recognition, etc.) that require additional permissions to access. In the embodiment of the present application, the system permissions that the current device needs to apply for are determined based on the preset application information (this implementation is to set a configuration file to associate the device model with the required permissions).
[0037] Furthermore, you can dynamically request the required permissions based on the Android ActivityCompat or ContextCompat classes. Android 6.0 (API level 23) and higher introduces a dynamic permission request mechanism. Therefore, apps must request permissions at runtime, not at installation time. Therefore, you can use the requestPermissions method in the ActivityCompat or ContextCompat classes to dynamically request permissions from the user. This section will not be discussed in detail here.
[0038] Furthermore, when the application is approved, the dynamic registration mode is completed.
[0039] When the user responds to the permission request (whether agreeing or denying), the system calls the activity's onRequestPermissionsResult method to process the user's response. If the permission is granted, the functionality that requires the permission can continue.
[0040] Understandably, if permission is denied, explain to the user why the permission is needed and provide a path to guide the user to manually enable the permission.
[0041] Step 3: Build a NetworkChangedReceiver based on the broadcast component under the Android system, and monitor the network status changes of the Android end based on the NetworkChangedReceiver.
[0042] First, call the Android system's broadcast component to construct a NetworkChangedReceiver and set the broadcast interception intent filter ConnectivityManager.CONNECTIVITY_ACTION in NetworkChangedReceiver. In Android, broadcast components allow apps to send and receive app-level or system-level events. NetworkChangedReceiver is a custom broadcast receiver that monitors changes in network status. Therefore, create a class that inherits from BroadcastReceiver and implement the onReceive method.
[0043] Intent filters are used to specify which broadcasts a broadcast receiver should receive. In NetworkChangedReceiver, set an intent filter to intercept broadcasts related to network status changes. ConnectivityManager.CONNECTIVITY_ACTION is a system broadcast that the system automatically sends when the network status (such as connecting or disconnecting) changes. By setting this intent filter in NetworkChangedReceiver, you ensure that the receiver receives these network status change broadcasts.
[0044] Furthermore, the NetworkEvent interface is exposed based on the NetworkChangedReceiver. This interface is a custom interface that defines callback methods related to network status changes. By having the NetworkChangedReceiver implement this interface, the receiver can call the methods in the interface to handle these changes when it receives a broadcast of a network status change.
[0045] Furthermore, NetworkChangedReceiver is registered to the Android side based on a dynamic registration method to receive changes in the network status of the Android side.
[0046] Dynamically registering NetworkChangedReceiver ensures that the receiver receives broadcasts of all network status changes that occur during application execution and processes these changes in a timely manner.
[0047] Step 4: Construct the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android terminal based on the preset networkevent interface, and obtain the current network information of the Android terminal to generate the network identifier of the Android terminal.
[0048] First, connect to the NetworkEvent interface based on the Activity parent class, NetworkBaseActivity, and obtain network change callback events based on this NetworkEvent interface. In Android development, an Activity is a separate screen within an application that contains the user interface. NetworkBaseActivity is a custom Activity parent class, meaning other Activities can inherit from it and share some common network processing logic.
[0049] The NetworkEvent interface defines callback methods related to network status changes. By connecting to the NetworkEvent interface, NetworkBaseActivity can receive notifications of network status changes. When the network status changes, methods in the NetworkEvent interface are called to detect the change.
[0050] Furthermore, network connection information is determined based on the network change callback event.
[0051] In the callback method of the NetworkEvent interface, NetworkBaseActivity can obtain detailed information about network status changes. This information may include network type (such as WiFi, mobile network), network status (such as connected, disconnected), network strength, etc. By parsing this information, NetworkBaseActivity can determine the current network connection information.
[0052] Furthermore, based on the acquired network connection information, a network identifier is generated to reflect the current network status; wherein the network identifier includes WiFi and mobile network.
[0053] The network ID is a string or identifier used to identify the current network status.
[0054] NetworkBaseActivity generates an identifier that accurately reflects the current network status based on the network connection information obtained from the NetworkEvent interface. The identifier can be used for application logic judgment, user interface updates, and other purposes.
[0055] For example, if the current connection is to a WiFi network, NetworkBaseActivity can generate a string identified as "WiFi"; if the connection is to a mobile network, it can generate a string identified as "Mobile Network".
[0056] When submitting page data, the network identifier is turned off and the network status is identified. If the network status is normal, the page data is submitted to the preset server. If the network is abnormal or the page data submission fails, the page data is submitted to the preset SQLlite database and marked as pending data. When the network status is normal, the pending data in the SQLlite database is uploaded to the server.
[0057] Before submitting page data, first close the network identifier that was previously used to reflect the current network status. This is because the process of submitting data requires a new network request, and the old network identifier may no longer be accurate or relevant.
[0058] After turning off the network logo, the current network status is immediately identified. The network status is divided into normal (i.e. the device is connected to the Internet) and abnormal (i.e. the device is not connected to the Internet or the connection is unstable).
[0059] If the network status is identified as normal, the page data is submitted directly to the preset server.
[0060] If the network status is abnormal or the page data submission fails due to other reasons (such as server response errors), the page data will be submitted to the preset SQLite database. When submitting to the database, the page data will be marked as pending data so that it can be resubmitted later when the network status is restored.
[0061] When the network returns to normal, the SQLite database is checked for pending data. If so, the data is uploaded to the server. Once the data has been successfully uploaded to the server and a confirmation response has been received, the data is deleted from the SQLite database to avoid duplicate submission or data redundancy.
[0062] Step 5: Compare the preset boot set according to the network identifier and the device model to generate a boot strategy.
[0063] First, a bootstrapping set is constructed, which includes multiple bootstrapping policies. A bootstrapping set is a collection of multiple bootstrapping policies. These policies are tailored to different network conditions, device models, and user needs. These policies may include instructions for connecting to Wi-Fi, switching network types, and configuring an APN (Access Point Name).
[0064] Furthermore, when the network identifier changes, the corresponding guidance policy is searched and displayed in the guidance set according to the current network identifier and the model. The specific steps are described by A1 to A4:
[0065] A1: When the network type is WiFi, the preset WifiManager class is used to close the WiFi connection and the user is guided to open the mobile network based on the guidance policy. When the network type is WiFi, it is necessary to close WiFi and switch to the mobile network. The preset WifiManager class is used to close the WiFi connection and the user is shown how to open the mobile network based on the guidance policy. It can be understood that the guidance policy is displayed based on the device model. The same applies to A2 to A4.
[0066] A2. When the network identifier is a mobile network, obtain all access point information and mobile phone card operator information of the user in the user's mobile phone, and determine whether the operator has a dedicated APN access point. When the network type is a mobile network, obtain the current network operator information and mobile phone card operator information.
[0067] A3. If a dedicated APN access point exists, guide the user to select the corresponding APN based on the guidance policy. If the operator has a dedicated APN access point, guide the user to select the correct APN based on the guidance policy. For example, a screen containing a list of available APNs is displayed, allowing the user to select.
[0068] A4. If the page cannot be redirected to the APN add page, guide the user to add a new APN access point based on the guidance policy. If the page cannot be redirected directly to the APN add page for some reason (for example, due to system settings restrictions), guide the user to manually add a new APN access point based on the guidance policy. For example, detailed step-by-step instructions or graphic tutorials can be provided to help the user complete the configuration.
[0069] Step 6: When the application corresponding to the Android terminal is in the background, remind the user of the Android terminal to switch networks.
[0070] First, connect the Application.ActivityLifecycleCallbacks interface preset on the Android side to listen to the life cycle of all activities. Application.ActivityLifecycleCallbacks is an interface provided by Android that allows applications to listen to the life cycle events of all activities. By implementing this interface, you can get the changes in the creation, start, pause, stop, and other life cycle states of an Activity. When the application connects to the Application.ActivityLifecycleCallbacks interface, it can listen to the life cycle changes of all activities. This includes the onPause and onStop states, which usually indicate that the Activity is or has lost the user's focus and may enter the background.
[0071] Further, when all activities enter the onPause or onStop state, it is determined that the application has entered the background.
[0072] Further, based on the guidance strategy, the user is prompted to switch to a normal network; wherein the normal network includes WiFi or mobile network. Once it is determined that the application has entered the background, the system will decide whether to prompt the user to switch the network based on the guidance strategy previously formulated. The normal network refers to WiFi or mobile network.
[0073] At the same time, in order to avoid the influence of APN on the normal use of the user to some extent, the following method is also included:
[0074] When the page enters the visible state callback method, register the NetworkChangedReceiver broadcast, and generate a guidance strategy by comparing the network identifier and the device model with the guidance set. When a page of the application enters the user visible state, the system will trigger the corresponding callback method. In the callback method, the application will register the broadcast of NetworkChangedReceiver. Then the application starts to listen to the changes in the network state, so as to respond in a timely manner when the network conditions change. Further, according to the current network identifier (such as WiFi, mobile network, etc.) and the device model, compare the preset guidance set to generate an appropriate guidance strategy. This guidance strategy may include how to configure the APN, how to switch the network type, etc., to ensure that the user can normally use the application under the current network conditions.
[0075] When the page is no longer visible, the callback method cancels the NetworkChangedReceiver broadcast registration. When the app's page is no longer visible to the user (for example, the user switches to another app or closes the current page), another callback method is triggered. In this callback method, the app cancels the NetworkChangedReceiver broadcast registration. The app no longer needs to listen for network status changes because the user is not currently interacting with the app.
[0076] Canceling broadcast registration can reduce the resource consumption of the application, avoid unnecessary background processing, and also avoid displaying notifications or reminders related to network changes when the user does not need them.
[0077] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, this application embodiment also provides an APN network application device in an Android environment, whose structure is as follows: Figure 2 shown.
[0078] Figure 2 The internal structure diagram of an APN network application device in an Android environment provided by the embodiment of this application. Figure 2 As shown, the equipment includes:
[0079] at least one processor 201;
[0080] and, a memory 202 communicatively coupled to the at least one processor;
[0081] The memory 202 stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor 201 to enable the at least one processor 201 to:
[0082] Build an APN network model and connect to the preset application; determine the model of the Android end and send a permission application based on the model to complete the dynamic registration mode; build a NetworkChangedReceiver based on the broadcast component under the Android system, and listen to the network status changes of the Android end based on NetworkChangedReceiver; build the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android end based on the preset networkevent interface, and obtain the current network information of the Android end to generate the network identifier of the Android end; compare the preset guidance set according to the network identifier and model to generate the guidance strategy; when the corresponding application on the Android end is in the background, remind the user of the Android end to switch networks.
[0083] Some embodiments of the present application provide corresponding Figure 1A non-volatile computer storage medium for an APN network application in an Android environment stores computer executable instructions, wherein the computer executable instructions are configured as follows:
[0084] Build an APN network model and connect to the preset application; determine the model of the Android end and send a permission application based on the model to complete the dynamic registration mode; build a NetworkChangedReceiver based on the broadcast component under the Android system, and listen to the network status changes of the Android end based on NetworkChangedReceiver; build the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android end based on the preset networkevent interface, and obtain the current network information of the Android end to generate the network identifier of the Android end; compare the preset guidance set according to the network identifier and model to generate the guidance strategy; when the corresponding application on the Android end is in the background, remind the user of the Android end to switch networks.
[0085] The various embodiments in this application are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences between the other embodiments. In particular, the IoT device and media embodiments are described briefly because they are generally similar to the method embodiments. For relevant portions, refer to the description of the method embodiments.
[0086] The system and medium provided in the embodiments of the present application correspond one-to-one to the method. Therefore, the system and medium also have similar beneficial technical effects to their corresponding methods. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the system and medium will not be repeated here.
[0087] Those skilled in the art will appreciate that the embodiments of the present application may provide methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0089] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0090] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0091] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0092] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0093] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0094] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0095] The above only describes the embodiments of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of claims of the present application.
Claims
1. An APN network application method in an Android environment, characterized in that: The method comprises: Build an APN network model and connect to a preset application; wherein the application is in an Android environment; Determine the device model of the Android terminal and send a permission request based on the device model to complete the dynamic registration mode; Construct a NetworkChangedReceiver based on the broadcast component under the Android system, and monitor the network status changes of the Android end based on the NetworkChangedReceiver; Construct the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android terminal based on the preset networkevent interface, and obtain the current network information of the Android terminal to generate the network identifier of the Android terminal; Comparing a preset boot set according to the network identifier and the device model to generate a boot strategy; When the application corresponding to the Android terminal is in the background, remind the user of the Android terminal to switch networks; Comparing a preset boot set according to the network identifier and the device model to generate a boot strategy, specifically including: Constructing the guidance set; wherein the guidance set includes multiple guidance strategies; When the network identifier changes, the corresponding boot strategy is searched and displayed in the boot set according to the current network identifier and the model; When the network identifier is WiFi, the WiFi connection is closed based on the preset WifiManager class, and the user is guided to open the mobile network based on the guidance strategy; When the network identifier is a mobile network, obtain all access point information and mobile phone card operator information of the user in the user's mobile phone, and determine whether the operator has a dedicated APN access point; If a dedicated APN access point exists, guiding the user to select the corresponding APN option based on the guidance policy; When the page cannot be redirected to add an APN, the user is guided to add a new APN access point based on the guidance policy.
2. The APN network application method in an Android environment according to claim 1, characterized in that: Determine the model of the Android terminal and send a permission request based on the model to complete the dynamic registration mode, specifically including: Obtain the device model of the Android terminal based on the Build class of the Android terminal; wherein the device model includes the manufacturer, code and update version; Compare the preset application information with the device model to determine the list of system permissions that need to be applied for; Dynamically apply for the required permissions based on the Android ActivityCompat class or ContextCompat class; When the application is approved, the dynamic registration mode is completed.
3. The APN network application method in an Android environment according to claim 1, characterized in that: Constructing a NetworkChangedReceiver based on the broadcast component under the Android system, and monitoring the network status changes of the Android terminal based on the NetworkChangedReceiver, specifically including: Call the broadcast component under the Android system to build a NetworkChangedReceiver and set the broadcast interception intent filter ConnectivityManager.CONNECTIVITY_ACTION in the NetworkChangedReceiver; Display the NetworkEvent interface based on the NetworkChangedReceiver; Register NetworkChangedReceiver to the Android side based on dynamic registration to receive network status changes of the Android side.
4. The APN network application method in an Android environment according to claim 1, characterized in that: Construct the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android terminal based on the preset NetworkEvent interface, and obtain the current network information of the Android terminal to generate the network identifier of the Android terminal, specifically including: Connecting to the NetworkEvent interface based on the Activity parent class NetworkBaseActivity, and obtaining a network change callback event based on the NetworkEvent interface; Determining network connection information based on the network change callback event; Based on the acquired network connection information, a network identifier is generated to reflect the current network status; wherein the network identifier includes WiFi and mobile network.
5. The APN network application method in an Android environment according to claim 4, characterized in that: The method further comprises: When the page data is submitted, the network identifier is closed and the network status is identified; If the network status is normal, the page data will be submitted to the preset server; If the network is abnormal or the page data submission fails, the page data is submitted to the preset SQLlite database and marked as data to be submitted; When the network status is normal, the data to be submitted in the SQLlite database is uploaded to the server.
6. The APN network application method in an Android environment according to claim 1, characterized in that: When the application corresponding to the Android terminal is in the background, reminding the user of the Android terminal to switch networks specifically includes: Connect to the Android-side default Application.ActivityLifecycleCallbacks interface to monitor the lifecycle of all Activities; When all activities enter the onPause or onStop state, it is determined that the application has entered the background; Based on the guidance strategy, the user is reminded to switch to a normal network; wherein the normal network includes WiFi or a mobile network.
7. The APN network application method in an Android environment according to claim 1, characterized in that: The method further comprises: When the page enters the visible state callback method, NetworkChangedReceiver broadcast registration is performed, and the boot set is compared according to the network identifier and the device model to generate a boot strategy; When the page is no longer visible, the callback method is called to cancel the NetworkChangedReceiver broadcast registration.
8. An APN network application device in an Android environment, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: Build an APN network model and connect to a preset application; wherein the application is in an Android environment; Determine the device model of the Android terminal and send a permission request based on the device model to complete the dynamic registration mode; Construct a NetworkChangedReceiver based on the broadcast component under the Android system, and monitor the network status changes of the Android end based on the NetworkChangedReceiver; Construct the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android terminal based on the preset networkevent interface, and obtain the current network information of the Android terminal to generate the network identifier of the Android terminal; Comparing a preset boot set according to the network identifier and the device model to generate a boot strategy; When the application corresponding to the Android terminal is in the background, remind the user of the Android terminal to switch networks; Comparing a preset boot set according to the network identifier and the device model to generate a boot strategy, specifically including: Constructing the guidance set; wherein the guidance set includes multiple guidance strategies; When the network identifier changes, the corresponding boot strategy is searched and displayed in the boot set according to the current network identifier and the model; When the network identifier is WiFi, the WiFi connection is closed based on the preset WifiManager class, and the user is guided to open the mobile network based on the guidance strategy; When the network identifier is a mobile network, obtain all access point information and mobile phone card operator information of the user in the user's mobile phone, and determine whether the operator has a dedicated APN access point; If a dedicated APN access point exists, guiding the user to select the corresponding APN option based on the guidance policy; When the page cannot be redirected to add an APN, the user is guided to add a new APN access point based on the guidance policy.
9. A non-volatile computer storage medium for an APN network application in an Android environment, storing computer-executable instructions, characterized in that: The computer executable instructions are configured to: Build an APN network model and connect to a preset application; wherein the application is in an Android environment; Determine the device model of the Android terminal and send a permission request based on the device model to complete the dynamic registration mode; Construct a NetworkChangedReceiver based on the broadcast component under the Android system, and monitor the network status changes of the Android end based on the NetworkChangedReceiver; Construct the Activity parent class NetworkBaseActivity, and obtain the callback event of the network status change of the Android terminal based on the preset networkevent interface, and obtain the current network information of the Android terminal to generate the network identifier of the Android terminal; Comparing a preset boot set according to the network identifier and the device model to generate a boot strategy; When the application corresponding to the Android terminal is in the background, remind the user of the Android terminal to switch networks; Comparing a preset boot set according to the network identifier and the device model to generate a boot strategy, specifically including: Constructing the guidance set; wherein the guidance set includes multiple guidance strategies; When the network identifier changes, the corresponding boot strategy is searched and displayed in the boot set according to the current network identifier and the model; When the network identifier is WiFi, the WiFi connection is closed based on the preset WifiManager class, and the user is guided to open the mobile network based on the guidance strategy; When the network identifier is a mobile network, obtain all access point information and mobile phone card operator information of the user in the user's mobile phone, and determine whether the operator has a dedicated APN access point; If a dedicated APN access point exists, guiding the user to select the corresponding APN option based on the guidance policy; When the page cannot be redirected to add an APN, the user is guided to add a new APN access point based on the guidance policy.
Citation Information
Patent Citations
Method and device for automatically obtaining authority
CN108171044A
A network connection management and control method and device
CN109819092A