CN113115482A - Terminal communication method and device based on android system, terminal and storage medium - Google Patents

Terminal communication method and device based on android system, terminal and storage medium Download PDF

Info

Publication number
CN113115482A
CN113115482A CN202110351848.9A CN202110351848A CN113115482A CN 113115482 A CN113115482 A CN 113115482A CN 202110351848 A CN202110351848 A CN 202110351848A CN 113115482 A CN113115482 A CN 113115482A
Authority
CN
China
Prior art keywords
current application
application program
network
channel
wifi
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110351848.9A
Other languages
Chinese (zh)
Other versions
CN113115482B (en
Inventor
于洪峰
林达浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Insta360 Innovation Technology Co Ltd
Original Assignee
Insta360 Innovation Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Insta360 Innovation Technology Co Ltd filed Critical Insta360 Innovation Technology Co Ltd
Priority to CN202110351848.9A priority Critical patent/CN113115482B/en
Publication of CN113115482A publication Critical patent/CN113115482A/en
Application granted granted Critical
Publication of CN113115482B publication Critical patent/CN113115482B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/15Setup of multiple wireless link connections
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/02Terminal devices
    • H04W88/06Terminal devices adapted for operation in multiple networks or having at least two operational modes, e.g. multi-mode terminals

Abstract

The invention is applicable to the technical field of mobile communication, and provides a terminal communication method, a device, a terminal and a medium based on an android system, wherein the method comprises the following steps: the method comprises the steps of determining the process type of the current application program process, establishing a first network channel based on the process type so that the current application program process can communicate by using a first network, obtaining an access request sent by a user to the current application program process, and determining whether to establish a second network channel for the current application program process based on the access request, so that the android terminal can realize the simultaneous use of double network channels to perform corresponding communication without frequent manual network switching by the user, and the user experience is improved.

Description

Terminal communication method and device based on android system, terminal and storage medium
Technical Field
The invention belongs to the technical field of mobile communication, and particularly relates to a terminal communication method and device based on an android system, a terminal and a storage medium.
Background
At present, most Android (Application) APPs (applications) on the market access networks by using a scoring strategy provided by system defaults, namely, the system can determine which network should be used at the moment according to the score of each network, and the score of a general wireless fidelity (WIFI) network is higher than that of a mobile network, so that the APP can use a WIFI network channel after being connected with the WIFI network. Although the scoring strategy technical scheme can use a better network channel, whether the APP can really access the Internet cannot be guaranteed.
Another scheme, intelligent WiFi, is provided in the Android system WLAN (Wireless Local Area Network) setting, that is, if it is detected that the current connection is WiFi which cannot access the internet, the mobile Network channel is automatically switched to. Although the intelligent WiFi scheme can automatically identify and switch to an available network, the intelligent WiFi scheme belongs to the self-contained function of the system, and the APP cannot control the selection of the network. If the APP wants to connect with other devices through WiFi for lan communication, the system is forced to switch network channels, which results in communication failure. The intelligent WiFi scheme can identify that the WiFi cannot access the Internet after the APP uses the WiFi to connect the local area network, and forces the local area network to be switched into a mobile network, so that the APP cannot access the local area network. In the scheme, the APP cannot autonomously select to be connected to a mobile network or a local area network, and the method has great limitation.
At present, many APPs need to establish LAN connection with other equipment in order to be used in collocation, for example, complete functions such as shooting, live broadcast, later stage editing with camera collocation, and after APP establishes LAN connection with other equipment through WiFi, will unable visit the Internet, thereby unable a series of functions such as login, browse community's content, internet file download of internet of using for example the Internet, intelligent WiFi scheme again can be discerned this WiFi can't visit the Internet, force to switch LAN into mobile network, lead to APP can't be connected with other equipment, it is thus visible, at present the user need manually switch the network passageway for APP in order to realize the visit of LAN resource or the visit of internet resource, seriously influence user experience, consequently, need a new technical scheme to solve this problem urgently.
Disclosure of Invention
Accordingly, it is desirable to provide a terminal communication method, device, terminal and storage medium based on the android system to solve the above technical problems.
In one aspect, the invention provides a terminal communication method based on an android system, and the method comprises the following steps:
determining the process type of the current application program process, and establishing a first network channel based on the process type so as to enable the current application program process to use a first network for communication;
acquiring an access request sent by a user to the current application program process;
determining whether to establish a second network channel for the current application process based on the access request.
Preferably, the step of determining the process type of the current application program process and establishing the first network channel based on the process type includes:
when the process type of the current application program process is determined to be an extranet process, establishing a mobile network channel for the current application program process;
and when the process type of the current application program process is determined to be the intranet process, establishing a WiFi network channel for the current application program process.
Preferably, when it is determined that the process type of the current application program process is an extranet process, the step of establishing a mobile network channel for the current application program process includes:
and requesting a mobile network channel through a requestNetwork function in a ConnectivityManager class of the android system so as to enable the current application program process to communicate by using a mobile network.
Preferably, when it is determined that the process type of the current application program process is an intranet process, the step of establishing a WiFi network channel for the current application program process includes:
and acquiring a WiFi network channel by using a scoring strategy provided by the android system so as to enable the current application program process to communicate by using a WiFi network.
Preferably, the step of determining whether to establish a second network channel for the current application program process based on the access request comprises:
determining whether to establish a WiFi network channel for the current application process based on the access request.
Preferably, the step of determining to establish a WiFi network channel for the current application program process based on the access request includes:
acquiring a WiFi-type network through a getNetworkInfo function in a ConnectivityManager class of an android system;
and calling an openConnection function to create a WiFi network channel through the obtained WiFi type network so that the current application program process can communicate by using a WiFi network.
In another aspect, the present invention provides a terminal communication device based on an android system, where the device includes:
the first channel establishing unit is used for determining the process type of the current application program process and establishing a first network channel based on the process type so as to enable the current application program process to use a first network for communication;
an access request obtaining unit, configured to obtain an access request sent by a user to the current application program process; and
and the second channel establishing unit is used for determining whether to establish a second network channel for the current application program process based on the access request.
Preferably, the first channel establishing unit includes:
a mobile channel establishing unit, configured to establish a mobile network channel for the current application program process when it is determined that the process type of the current application program process is an extranet process; and
and the WiFi channel establishing unit is used for establishing a WiFi network channel for the current application program process when the process type of the current application program process is determined to be the intranet process.
Preferably, the moving path establishing unit includes:
and the mobile channel request unit is used for requesting a mobile network channel through a requestNetwork function in a ConnectivityManager class of the android system so as to enable the current application program process to use a mobile network for communication.
Preferably, the WiFi channel establishing unit includes:
and the WiFi channel acquisition unit is used for acquiring a WiFi network channel by using a scoring strategy provided by the android system so as to enable the current application program process to communicate by using a WiFi network.
Preferably, the second channel establishing unit includes:
a channel establishing subunit, configured to determine whether to establish a WiFi network channel for the current application program process based on the access request.
Preferably, the channel establishing subunit includes:
the network acquisition unit is used for acquiring a WiFi-type network through a getNetworkInfo function in a ConnectivityManager class of the android system; and
and the channel creating unit is used for creating a WiFi network channel by calling an openConnection function through the obtained WiFi type network so as to enable the current application program process to use a WiFi network for communication.
In another aspect, the present invention further provides a mobile terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the terminal communication method based on the android system when executing the computer program.
In another aspect, the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the method for terminal communication based on the android system are implemented.
The method and the device determine the process type of the current application program process, establish the first network channel based on the process type so that the current application program process uses the first network for communication, acquire the access request sent by the user to the current application program process, and determine whether to establish the second network channel for the current application program process based on the access request, so that the android terminal can realize the simultaneous use of the two network channels to perform corresponding communication without frequently and manually switching the network by the user, and the user experience is improved.
Drawings
Fig. 1 is a flowchart illustrating an implementation of a terminal communication method based on an Android system according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating an implementation of a terminal communication method based on an Android system according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a terminal communication device based on an Android system according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal communication device based on an Android system according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a mobile terminal according to a fifth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The following detailed description of specific implementations of the present invention is provided in conjunction with specific embodiments:
the first embodiment is as follows:
fig. 1 shows an implementation flow of a terminal communication method based on an android system according to a first embodiment of the present invention, and for convenience of description, only a part related to the embodiment of the present invention is shown, which is detailed as follows:
in step S101, a process type of the current application process is determined, and a first network channel is established based on the process type, so that the current application process uses a first network for communication.
The embodiment of the invention is suitable for mobile terminals which simultaneously support cellular data and WiFi, such as smart phones, tablet computers (pads), telephone watches and the like. In an APP, one or more application program processes can be created for the APP, each application program process runs independently, and relationships between the created multiple application program processes can be a parent process and a child process. After the APP is started, a Process Identification (PID) of a current application program Process is obtained, the Process type of the current application program Process is determined to be an extranet Process or an intranet Process according to the obtained PID, and then a first network channel is established based on the Process type, so that the current application program Process uses a first network for communication.
Before determining the process type of the current application program process, preferably, creating the application program process, obtaining a unique PID allocated by the system for the application program process, and setting the process type of the application program process, where the process type is an extranet process or an intranet process, as an example, creating a first process and a sub-process of the first process: the second process and the third process, the first process being a main process, which is a process interacting with a user and needs to communicate with the internet and occasionally needs to access the local area network, therefore, the process type of the first process is set as an extranet process, the second process is a sub-process needing to access the local area network, and a task communicating with the local area network is run as compared with a downloading local area network file.
In step S102, an access request sent by the user to the current application program process is acquired.
In the embodiment of the invention, when the current application program process is a process capable of interacting with a user, the user can send a corresponding access request to the current application program process by triggering a search key or a function module button, when the current application program process is a sub-process which does not directly interact with the user, the main process can receive the access request sent by the user and judge which sub-process the access request is processed by, and when the main process determines that the access request is processed by the current application program process, the main process sends the access request to the current application program process.
In step S103, it is determined whether to establish a second network channel for the current application process based on the access request.
In the embodiment of the invention, whether the access request can be completed by using the first network is judged by the current application program process, if so, the first network is continuously used, and if not, a second network channel is established for the current application program process so as to switch the current application program process to the second network to complete the access request.
In the embodiment of the invention, the process type of the current application program process is determined, the first network channel is established based on the process type, so that the current application program process uses the first network for communication, the access request sent by the user to the current application program process is obtained, and whether the second network channel is established for the current application program process is determined based on the access request, so that the android terminal can realize the simultaneous use of the two network channels for corresponding communication under the condition that the user does not need to frequently and manually switch the network, and the user experience is improved.
Example two:
fig. 2 shows an implementation flow of a terminal communication method based on the android system according to a second embodiment of the present invention, and for convenience of description, only parts related to the second embodiment of the present invention are shown, which are detailed as follows:
in step S201, the process type of the current application process is determined.
The embodiment of the invention is suitable for mobile terminals which simultaneously support cellular data and WiFi, such as smart phones, pads, telephone watches and the like. In an APP, one or more application program processes can be created for the APP, each application program process runs independently, and relationships between the created multiple application program processes can be a parent process and a child process. After the APP is started, the PID of the current application program process is obtained, the process type of the current application program process is judged to be an extranet process or an intranet process according to the obtained PID, when the process type of the current application program process is judged to be the extranet process, the step S202 is executed, and when the process type of the current application program process is judged to be the intranet process, the step S203 is executed.
In step S202, a mobile network tunnel is established for the current application program process.
In the embodiment of the invention, when the process type of the current application program process is judged to be the extranet process, a mobile network channel is established for the current application program process so as to realize the access of the current application program process to the internet resources by using the mobile network.
When a mobile network channel is established for a current application program process, preferably, the mobile network channel is requested through a requestNetwork function in a ConnectivityManager class of an android system, specifically, a ConnectivityManager.
After a mobile network channel is established for the current application program process, preferably, the state of the mobile network is monitored, when the monitored state is unavailable, the connection between the current application program process and the mobile network is disconnected, and the current application program process and the mobile network are bound again when the mobile network is waited to recover, so that the default network communication of the APP is prevented from being abnormal.
In step S203, a WiFi network channel is established for the current application process.
In the embodiment of the invention, when the process type of the current application program process is judged to be the intranet process, a grading strategy provided by the Android system in a default mode can be used for obtaining the WiFi network channel with the highest grade, and the current application program process is automatically connected to the WiFi network, so that the current application program process is connected with other equipment through the WiFi network, and the access to local area network resources in other equipment is completed. Of course, other scoring strategies may also be adopted to obtain the WiFi network channel, and the application is not particularly limited.
In step S204, an access request sent by the user to the current application program process is acquired.
In the embodiment of the invention, when the current application program process is a process capable of interacting with a user, the user can send a corresponding access request to the current application program process by triggering a search key or a function module button, when the current application program process is a sub-process which does not directly interact with the user, the main process can receive the access request sent by the user and judge which sub-process the access request is processed by, and when the main process determines that the access request is processed by the current application program process, the main process sends the access request to the current application program process.
In step S205, it is determined whether to establish a WiFi network channel for the current application process based on the access request.
In the embodiment of the invention, when the current application program process uses the mobile network, the current application program process judges whether the mobile network can be continuously used to finish the access request, if so, the network does not need to be switched, otherwise, a WiFi network channel is established for the current application program process to finish the access request by using the WiFi network, and when the current application program process uses the WiFi network, the current application program process does not need to be finishedAgain, theAnd establishing a WiFi network channel.
When a WiFi network channel is established for a current application program process, preferably, a WiFi type network is obtained through a getnetworklnfo function in a ConnectivityManager class of an android system, an openconnectionfunction is called through the obtained WiFi type network to establish the WiFi network channel, specifically, a connectivitymanager.getnetworklnfo method is called to find a network with a type of connectivitymanager.TYPE _ WiFi, and a network request based on the WiFi network is established through the network.openconnectionconnection (String) function to perform local area network access, so that under the condition that the current application program process is bound with a mobile network, the WiFi can be used to connect with other devices to temporarily access local area network resources in other devices, and user experience is improved.
In the embodiment of the invention, when the process type of the current application program process is determined to be the extranet process, the mobile network channel is established for the current application program process, when the process type of the current application program process is determined to be the intranet process, the WiFi network channel is established for the current application program process, the access request sent by a user to the current application program process is obtained, and whether the WiFi network channel is established for the current application program process is determined based on the access request, so that the APP can be used simultaneously by the WiFi/mobile network double-network channel, the APP can normally access the Internet while carrying out local area network connection with other matched equipment, the network is not required to be frequently and manually switched by the user, and the user experience is optimized.
Example three:
fig. 3 shows a structure of a terminal communication device based on an android system according to a third embodiment of the present invention, and for convenience of description, only a part related to the third embodiment of the present invention is shown, where the structure includes:
the first channel establishing unit 31 is configured to determine a process type of the current application program process, and establish a first network channel based on the process type, so that the current application program process uses a first network for communication.
The embodiment of the invention is suitable for mobile terminals which simultaneously support cellular data and WiFi, such as smart phones, tablet computers (pads), telephone watches and the like. In an APP, one or more application program processes can be created for the APP, each application program process runs independently, and relationships between the created multiple application program processes can be a parent process and a child process. After the APP is started, a Process Identification (PID) of a current application program Process is obtained, the Process type of the current application program Process is determined to be an extranet Process or an intranet Process according to the obtained PID, and then a first network channel is established based on the Process type, so that the current application program Process uses a first network for communication.
Before determining the process type of the current application program process, preferably, creating the application program process, obtaining a unique PID allocated by the system for the application program process, and setting the process type of the application program process, where the process type is an extranet process or an intranet process, as an example, creating a first process and a sub-process of the first process: the second process and the third process, the first process being a main process, which is a process interacting with a user and needs to communicate with the internet and occasionally needs to access the local area network, therefore, the process type of the first process is set as an extranet process, the second process is a sub-process needing to access the local area network, and a task communicating with the local area network is run as compared with a downloading local area network file.
An access request obtaining unit 32, configured to obtain an access request sent by a user to a current application program process.
In the embodiment of the invention, when the current application program process is a process capable of interacting with a user, the user can send a corresponding access request to the current application program process by triggering a search key or a function module button, when the current application program process is a sub-process which does not directly interact with the user, the main process can receive the access request sent by the user and judge which sub-process the access request is processed by, and when the main process determines that the access request is processed by the current application program process, the main process sends the access request to the current application program process.
And a second channel establishing unit 33, configured to determine whether to establish a second network channel for the current application program process based on the access request.
In the embodiment of the invention, whether the access request can be completed by using the first network is judged by the current application program process, if so, the first network is continuously used, otherwise, a second network channel is established for the current application program process, so that the current application program process is switched to the second network to complete the access request.
In the embodiment of the present invention, each unit of the terminal communication device based on the android system may be implemented by a corresponding hardware or software unit, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Example four:
fig. 4 shows a structure of a terminal communication device based on an android system according to a fourth embodiment of the present invention, and for convenience of description, only a part related to the embodiment of the present invention is shown, where the structure includes:
the first channel establishing unit 41 is configured to determine a process type of the current application program process, and establish a first network channel based on the process type, so that the current application program process uses a first network for communication.
The embodiment of the invention is suitable for mobile terminals which simultaneously support cellular data and WiFi, such as smart phones, tablet computers (pads), telephone watches and the like. In an APP, one or more application program processes can be created for the APP, each application program process runs independently, and relationships between the created multiple application program processes can be a parent process and a child process. After the APP is started, a Process Identification (PID) of a current application program Process is obtained, the Process type of the current application program Process is determined to be an extranet Process or an intranet Process according to the obtained PID, and then a first network channel is established based on the Process type, so that the current application program Process uses a first network for communication.
Before determining the process type of the current application program process, preferably, creating the application program process, obtaining a unique PID allocated by the system for the application program process, and setting the process type of the application program process, where the process type is an extranet process or an intranet process, as an example, creating a first process and a sub-process of the first process: the second process and the third process, the first process being a main process, which is a process interacting with a user and needs to communicate with the internet and occasionally needs to access the local area network, therefore, the process type of the first process is set as an extranet process, the second process is a sub-process needing to access the local area network, and a task communicating with the local area network is run as compared with a downloading local area network file.
And an access request obtaining unit 42, configured to obtain an access request sent by a user to a current application program process.
In the embodiment of the invention, when the current application program process is a process capable of interacting with a user, the user can send a corresponding access request to the current application program process by triggering a search key or a function module button, when the current application program process is a sub-process which does not directly interact with the user, the main process can receive the access request sent by the user and judge which sub-process the access request is processed by, and when the main process determines that the access request is processed by the current application program process, the main process sends the access request to the current application program process.
A second channel establishing unit 43, configured to determine whether to establish a second network channel for the current application program process based on the access request.
In the embodiment of the invention, whether the access request can be completed by using the first network is judged by the current application program process, if so, the first network is continuously used, otherwise, a second network channel is established for the current application program process, so that the current application program process is switched to the second network to complete the access request.
Wherein, the first channel establishing unit 41 includes:
a mobile channel establishing unit 411, configured to establish a mobile network channel for the current application program process when it is determined that the process type of the current application program process is an extranet process.
In the embodiment of the present invention, after the mobile network channel is established for the current application program process, preferably, the state of the mobile network is monitored, and when the monitored state is unavailable, the connection between the current application program process and the mobile network is disconnected, and the current application program process and the mobile network are bound again when the mobile network is waited to recover, so that the default network communication of the APP is prevented from being abnormal.
And a WiFi channel establishing unit 412, configured to establish a WiFi network channel for the current application program process when it is determined that the process type of the current application program process is the intranet process.
The moving path establishing unit 411 includes:
a mobile channel requesting unit 4111, configured to request a mobile network channel through a requestNetwork function in a ConnectivityManager class of the android system, so that a current application program process uses a mobile network for communication.
In the embodiment of the invention, the mobile network channel is requested by calling the connectivitymanager. requestnetwork method, and the current application program process always enforces the use of the mobile network after the request is successful, so that the current application program process uses the mobile network to access the internet resources.
The WiFi channel establishing unit 412 includes:
and a WiFi channel obtaining unit 4121, configured to obtain a WiFi network channel using a scoring policy provided by the android system, so that the current application process uses a WiFi network for communication.
In the embodiment of the invention, when the process type of the current application program process is determined to be the intranet process, a grading strategy provided by an Android system in a default mode is used for obtaining the WiFi network channel with the highest grade, and the current application program process is automatically connected to the WiFi network, so that the current application program process is connected with other equipment through the WiFi network, and the access to local area network resources in other equipment is completed.
The second channel establishing unit 43 includes:
a channel establishing subunit 431, configured to determine whether to establish a WiFi network channel for the current application program process based on the access request.
The channel establishing subunit 431 includes:
a network obtaining unit 4311, configured to obtain a WiFi-type network through a getnetworklnfo function in a ConnectivityManager class of the android system; and
the channel creating unit 4312 is configured to create a WiFi network channel by calling an openConnection function through the obtained WiFi type network, so that the current application program process uses a WiFi network for communication.
In the embodiment of the invention, when the current application program process uses the WiFi network, the WiFi network channel does not need to be established for the current application program process, when the current application program process uses the mobile network, judging whether the mobile network can be continuously used to complete the access request or not through the current application program process, if so, not switching the network, otherwise, establishing a WiFi network channel for the current application program process, to complete the access request by using the WiFi network, specifically, call connectivitymanager.getnetworkinfo method, find a network with type of connectivitymanager.type _ WiFi, create a WiFi network-based network request for local area network access using a network. Therefore, under the condition that the current application program process is bound with the mobile network, the WiFi can be used for being connected with other equipment so as to temporarily access local area network resources in other equipment, and the user experience is improved.
In the embodiment of the present invention, each unit of the terminal communication device based on the android system may be implemented by a corresponding hardware or software unit, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Example five:
fig. 5 shows a structure of a mobile terminal according to a fifth embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown.
The mobile terminal 5 of the embodiment of the present invention includes a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and operable on the processor 50. When the processor 50 executes the computer program 52, the steps in the embodiment of the terminal communication method based on the android system, such as steps S101 to S103 shown in fig. 1, are implemented. Alternatively, the processor 50, when executing the computer program 52, implements the functions of the units in the above-described device embodiments, such as the functions of the units 31 to 33 shown in fig. 3.
In the embodiment of the invention, the process type of the current application program process is determined, the first network channel is established based on the process type, so that the current application program process uses the first network for communication, the access request sent by the user to the current application program process is obtained, and whether the second network channel is established for the current application program process is determined based on the access request, so that the android terminal can realize the simultaneous use of the two network channels for corresponding communication under the condition that the user does not need to frequently and manually switch the network, and the user experience is improved.
The mobile terminal of the embodiment of the invention can be a smart phone, a tablet personal computer, a telephone watch and the like. For the steps implemented when the processor 50 in the mobile terminal 5 executes the computer program 52 to implement the terminal communication method based on the android system, reference may be made to the description of the foregoing method embodiment, which is not described herein again.
Example six:
in the embodiment of the present invention, a computer-readable storage medium is provided, where a computer program is stored, and when being executed by a processor, the computer program implements the steps in the embodiment of the terminal communication method based on the android system, for example, steps S101 to S103 shown in fig. 1. Alternatively, the computer program may be adapted to perform the functions of the units of the above-described device embodiments, such as the functions of the units 31 to 33 shown in fig. 3, when executed by the processor.
In the embodiment of the invention, the process type of the current application program process is determined, the first network channel is established based on the process type, so that the current application program process uses the first network for communication, the access request sent by the user to the current application program process is obtained, and whether the second network channel is established for the current application program process is determined based on the access request, so that the android terminal can realize the simultaneous use of the two network channels for corresponding communication under the condition that the user does not need to frequently and manually switch the network, and the user experience is improved.
The computer readable storage medium of the embodiments of the present invention may include any entity or device capable of carrying computer program code, a recording medium, such as a ROM/RAM, a magnetic disk, an optical disk, a flash memory, or the like.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (14)

1. A terminal communication method based on an android system is characterized by comprising the following steps:
determining the process type of the current application program process, and establishing a first network channel based on the process type so as to enable the current application program process to use a first network for communication;
acquiring an access request sent by a user to the current application program process;
determining whether to establish a second network channel for the current application process based on the access request.
2. The method of claim 1, wherein determining a process type of a current application process, and establishing the first network channel based on the process type comprises:
when the process type of the current application program process is determined to be an extranet process, establishing a mobile network channel for the current application program process;
and when the process type of the current application program process is determined to be the intranet process, establishing a WiFi network channel for the current application program process.
3. The method of claim 2, wherein the step of establishing a mobile network tunnel for the current application process when the process type of the current application process is determined to be an extranet process comprises:
and requesting a mobile network channel through a requestNetwork function in a ConnectivityManager class of the android system so as to enable the current application program process to communicate by using a mobile network.
4. The method according to claim 2, wherein when the process type of the current application process is determined to be an intranet process, the step of establishing a WiFi network channel for the current application process comprises:
and acquiring a WiFi network channel by using a preset scoring strategy so that the current application program process uses a WiFi network for communication.
5. The method of claim 2, wherein the step of determining whether to establish a second network channel for the current application process based on the access request comprises:
determining whether to establish a WiFi network channel for the current application process based on the access request.
6. The method of claim 5, wherein determining to establish a WiFi network channel for the current application process based on the access request comprises:
acquiring a WiFi-type network through a getNetworkInfo function in a ConnectivityManager class of an android system;
and calling an openConnection function to create a WiFi network channel through the obtained WiFi type network so that the current application program process can communicate by using a WiFi network.
7. The utility model provides a terminal communication device based on tall and erect system of ann, its characterized in that, the device includes:
the first channel establishing unit is used for determining the process type of the current application program process and establishing a first network channel based on the process type so as to enable the current application program process to use a first network for communication;
an access request obtaining unit, configured to obtain an access request sent by a user to the current application program process; and
and the second channel establishing unit is used for determining whether to establish a second network channel for the current application program process based on the access request.
8. The apparatus of claim 7, wherein the first channel establishing unit comprises:
a mobile channel establishing unit, configured to establish a mobile network channel for the current application program process when it is determined that the process type of the current application program process is an extranet process; and
and the WiFi channel establishing unit is used for establishing a WiFi network channel for the current application program process when the process type of the current application program process is determined to be the intranet process.
9. The apparatus of claim 8, wherein the moving channel establishing unit comprises:
and the mobile channel request unit is used for requesting a mobile network channel through a requestNetwork function in a ConnectivityManager class of the android system so as to enable the current application program process to use a mobile network for communication.
10. The apparatus of claim 8, wherein the WiFi channel establishing unit comprises:
and the WiFi channel acquisition unit is used for acquiring a WiFi network channel by using a scoring strategy provided by the android system so as to enable the current application program process to communicate by using a WiFi network.
11. The apparatus of claim 8, wherein the second channel establishing unit comprises:
a channel establishing subunit, configured to determine whether to establish a WiFi network channel for the current application program process based on the access request.
12. The apparatus of claim 11, wherein the channel establishing subunit comprises:
the network acquisition unit is used for acquiring a WiFi-type network through a getNetworkInfo function in a ConnectivityManager class of the android system; and
and the channel creating unit is used for creating a WiFi network channel by calling an openConnection function through the obtained WiFi type network so as to enable the current application program process to use a WiFi network for communication.
13. A mobile terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202110351848.9A 2021-03-31 2021-03-31 Terminal communication method and device based on android system, terminal and storage medium Active CN113115482B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110351848.9A CN113115482B (en) 2021-03-31 2021-03-31 Terminal communication method and device based on android system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110351848.9A CN113115482B (en) 2021-03-31 2021-03-31 Terminal communication method and device based on android system, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN113115482A true CN113115482A (en) 2021-07-13
CN113115482B CN113115482B (en) 2022-11-22

Family

ID=76713451

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110351848.9A Active CN113115482B (en) 2021-03-31 2021-03-31 Terminal communication method and device based on android system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN113115482B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114071628A (en) * 2022-01-06 2022-02-18 深圳佑驾创新科技有限公司 Terminal communication method and device based on android system and storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104869569A (en) * 2015-03-31 2015-08-26 小米科技有限责任公司 Network permission control method and apparatus of application program
CN105357770A (en) * 2015-09-25 2016-02-24 深圳市天海基业科技有限公司 Communication method, device and system
CN106332307A (en) * 2015-07-03 2017-01-11 华为技术有限公司 Method for application program access to network and mobile terminal
WO2017008722A1 (en) * 2015-07-10 2017-01-19 努比亚技术有限公司 Intranet-extranet separation-based communication method, server and system
CN107402791A (en) * 2017-07-31 2017-11-28 广东欧珀移动通信有限公司 Applied program processing method, device, storage medium and terminal
CN107426112A (en) * 2017-07-26 2017-12-01 珠海市魅族科技有限公司 Operation method, device and the computer installation of working application based on WIFI network
CN108173909A (en) * 2017-12-15 2018-06-15 北京臻迪科技股份有限公司 Method of data synchronization, mobile terminal and computer readable storage medium
CN108391298A (en) * 2018-05-25 2018-08-10 四川斐讯全智信息技术有限公司 A kind of system and electronic equipment of network automatic switchover
CN108495348A (en) * 2018-01-31 2018-09-04 上海连尚网络科技有限公司 It is a kind of for the method for switching network of user equipment, equipment and medium
CN109362111A (en) * 2018-12-24 2019-02-19 上海连尚网络科技有限公司 Information cuing method
WO2019080713A1 (en) * 2017-10-26 2019-05-02 Huawei Technologies Co., Ltd. Method and apparatus for managing hardware resource access in an electronic device
CN110191493A (en) * 2019-04-30 2019-08-30 山西大学 A kind of network automatic switching method and device of mobile terminal device

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104869569A (en) * 2015-03-31 2015-08-26 小米科技有限责任公司 Network permission control method and apparatus of application program
CN106332307A (en) * 2015-07-03 2017-01-11 华为技术有限公司 Method for application program access to network and mobile terminal
WO2017008722A1 (en) * 2015-07-10 2017-01-19 努比亚技术有限公司 Intranet-extranet separation-based communication method, server and system
CN105357770A (en) * 2015-09-25 2016-02-24 深圳市天海基业科技有限公司 Communication method, device and system
CN107426112A (en) * 2017-07-26 2017-12-01 珠海市魅族科技有限公司 Operation method, device and the computer installation of working application based on WIFI network
CN107402791A (en) * 2017-07-31 2017-11-28 广东欧珀移动通信有限公司 Applied program processing method, device, storage medium and terminal
WO2019080713A1 (en) * 2017-10-26 2019-05-02 Huawei Technologies Co., Ltd. Method and apparatus for managing hardware resource access in an electronic device
CN108173909A (en) * 2017-12-15 2018-06-15 北京臻迪科技股份有限公司 Method of data synchronization, mobile terminal and computer readable storage medium
CN108495348A (en) * 2018-01-31 2018-09-04 上海连尚网络科技有限公司 It is a kind of for the method for switching network of user equipment, equipment and medium
CN108391298A (en) * 2018-05-25 2018-08-10 四川斐讯全智信息技术有限公司 A kind of system and electronic equipment of network automatic switchover
CN109362111A (en) * 2018-12-24 2019-02-19 上海连尚网络科技有限公司 Information cuing method
CN110191493A (en) * 2019-04-30 2019-08-30 山西大学 A kind of network automatic switching method and device of mobile terminal device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114071628A (en) * 2022-01-06 2022-02-18 深圳佑驾创新科技有限公司 Terminal communication method and device based on android system and storage medium

Also Published As

Publication number Publication date
CN113115482B (en) 2022-11-22

Similar Documents

Publication Publication Date Title
US10314098B2 (en) Method and apparatus for connecting short-range wireless communication in terminal
US20230075764A1 (en) Access control method and apparatus, communication device, and storage medium
US8874167B2 (en) Method and system for multi-standby operation for a multi-SIM multi-standby communication device
US9918219B2 (en) Call management method and apparatus for multi-SIM multi-active terminal
CN112567685A (en) Method, apparatus and computer program
CN111837425A (en) Access method, access device and storage medium
CN106961676B (en) Network searching method, device and medium
WO2015148711A1 (en) Wireless system selection factoring rf resource availability in dual access phones
EP3763164B1 (en) Electronic device supporting multiple wireless communication protocols and method therefor
WO2017219508A1 (en) Communication method and apparatus for multi-mode terminal
US20150056944A1 (en) Method and system for providing emergency number list to user in case of failed registration
CN113348697B (en) Wireless communication method, device and system
CN104871599A (en) Systems and methods for searching for radio access technologies
CN101287233A (en) Method and system for implementing STK application in double-card double-standby terminal
EP3624546B1 (en) Packet data unit (pdu) session control method and apparatus
CN113115482B (en) Terminal communication method and device based on android system, terminal and storage medium
CN107466022B (en) SIM card switching method, mobile terminal and storage medium
CN109451832B (en) Wireless communication method, device and computer readable storage medium
US20220022028A1 (en) Profile and subscription management for wireless devices
CN111866817B (en) D2D terminal mode communication selection method under 5G hybrid networking
US10368210B2 (en) Service processing method, terminal device, and service roaming network
CN114245370B (en) Communication management method, device, server and computer storage medium
CN107182044B (en) Mobile terminal, Bluetooth connection processing method thereof and storage medium
CN105491607B (en) Processing method, application processor and the mobile terminal of network communicating function exception
CN113395688A (en) Voice data processing method, device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant