CN106502747A - A kind of method of application upgrade and mobile terminal - Google Patents

A kind of method of application upgrade and mobile terminal Download PDF

Info

Publication number
CN106502747A
CN106502747A CN201610948962.9A CN201610948962A CN106502747A CN 106502747 A CN106502747 A CN 106502747A CN 201610948962 A CN201610948962 A CN 201610948962A CN 106502747 A CN106502747 A CN 106502747A
Authority
CN
China
Prior art keywords
intended application
edition
upgrade
information
mobile terminal
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.)
Pending
Application number
CN201610948962.9A
Other languages
Chinese (zh)
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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201610948962.9A priority Critical patent/CN106502747A/en
Publication of CN106502747A publication Critical patent/CN106502747A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention discloses a kind of method of application upgrade and mobile terminal, are applied to technical field of mobile terminals.Present invention method includes:Obtain the first version information of mounted intended application in mobile terminal;Intended application upgrade information in the server is obtained from server, upgrade information includes the escalation policy of the intended application of intended application second edition information in the server and the second edition;If first version information is different from second edition information, and the escalation policy of the intended application of the second edition is mandatory upgrade, then download the intended application of the second edition from server, and carry out mandatory upgrade in mobile terminal.The embodiment of the present invention avoids that current application upgrade strategy is single, and some application version users for serious problems occur are not upgraded, and cause cannot normally using application or leaking data the problems such as, improve security and convenience that application is used.

Description

A kind of method of application upgrade and mobile terminal
Technical field
The present invention relates to technical field of mobile terminals, more particularly to a kind of method of application upgrade and mobile terminal.
Background technology
Mode generally by version iteration in Android exploitations constantly to carry out updating operation to application, upgrades The conventional mode of application is to prompt the user whether that needs are upgraded by ejecting cue button, if user clicks on to agree to rise Level, now can be installed after being downloaded to application again, and installation process needs user to click on confirmation manually.
The processing procedure of conventional upgrading scheme deals with cumbersome, and all applications are required for user to be pacified manually Dress, simultaneously for the application of some versions, being likely to occur serious problem in use needs all users to be risen Level, now if there are certain customers be just likely to occur not as being upgraded user cannot normally using the application, or Person causes the incompatible problem of uncontrollable leaking data or software and hardware, these problems to belong in software development process using the application In very serious problem, and escalation policy is single in current application upgrade scheme, and do not solved the above problems is effective Scheme.
Content of the invention
A kind of method of application upgrade and mobile terminal is embodiments provided, current application upgrade strategy list is solved One, it is to avoid some application version users for serious problems occur are not upgraded, and cause cannot normally using application or data The problems such as leakage.
In a first aspect, the application provides a kind of upgrade method of application, mobile terminal is applied to, methods described includes:
Obtain the first version information of mounted intended application in the mobile terminal;
Upgrade information of the intended application in the server is obtained from server, the upgrade information includes institute State the escalation policy of the intended application of second edition information and the second edition of the intended application in the server, institute Stating the escalation policy that applies in server includes common upgrading and mandatory upgrade;
Judge whether the first version information is identical with the second edition information;
If the first version information is different from the second edition information, and the liter of the intended application of the second edition Level strategy is mandatory upgrade, then download the intended application of the second edition from the server, and according to the escalation policy Mandatory upgrade is carried out to the mobile terminal.
Preferably, methods described also includes:
If the first version information is different from the second edition information, and the liter of the intended application of the second edition Level strategy is common upgrading, then detect whether the instruction for getting the intended application that user confirms to install the second edition;
If getting the instruction of the intended application that user confirms to install the second edition, institute is downloaded from the server The intended application of the second edition is stated, and is directly installed.
Preferably, described from server obtain the upgrade information of the intended application in the server the step of, tool Body includes:
To the request that the server sends the intended application upgrade information;
Receive the upgrade information of the JSON forms that the server is returned;
Wherein, the upgrade information of the JSON forms includes the second edition information field of the intended application, described The escalation policy field of the intended application of the second edition, the download address field of the intended application of the second edition, Yi Jisuo State the check code field of the intended application of the second edition.
Preferably, described the step of carry out mandatory upgrade to the mobile terminal, specifically include:
Detect whether the mobile terminal has superuser right;
If so, the mandatory upgrade that is then mourned in silence in the mobile terminal by the superuser right;
If it is not, then press key message simulation is sent by the default script of execution clicks on confirmation upgrade event, carry out mandatory upgrade.
Preferably, before the step of carrying out mandatory upgrade to the mobile terminal, methods described also includes:
Obtain the first check code of the intended application of the second edition that downloads;
Obtain the second check code of the intended application in the second edition for locally pre-saving;
Judge whether the first check code is identical with second check code, if identical, just execute to enter the mobile terminal The step of row mandatory upgrade.
Second aspect, the application provide a kind of mobile terminal, including:
Version information acquiring unit, believes for obtaining the first version of mounted intended application in the mobile terminal Breath;
Upgrade information acquiring unit, for obtaining upgrading letter of the intended application in the server from server Breath, the upgrade information include second edition information and the second edition of the intended application in the server Intended application escalation policy, the escalation policy that applies in the server includes common upgrading and mandatory upgrade;
Judging unit, for judging whether the first version information is identical with the second edition information;
Upgrade unit, if different from the second edition information for the first version information, and the second edition The escalation policy of intended application be mandatory upgrade, from the intended application that the server downloads the second edition, and according to The escalation policy carries out mandatory upgrade to the mobile terminal.
Preferably, the upgrade unit is additionally operable to:
If the first version information is different from the second edition information, and the liter of the intended application of the second edition Level strategy is common upgrading, then detect whether the instruction for getting the intended application that user confirms to install the second edition;
If getting the instruction of the intended application that user confirms to install the second edition, institute is downloaded from the server The intended application of the second edition is stated, and is directly installed.
Preferably, the upgrade information acquiring unit specifically for:
To the request that the server sends the intended application upgrade information;
Receive the upgrade information of the JSON forms that the server is returned;
Wherein, the upgrade information of the JSON forms includes the second edition information field of the intended application, described The escalation policy field of the intended application of the second edition, the download address field of the intended application of the second edition, Yi Jisuo State the check code field of the intended application of the second edition.
Preferably, the upgrade unit specifically for:
Detect whether the mobile terminal has superuser right;
If so, the mandatory upgrade that is then mourned in silence in the mobile terminal by the superuser right;
If it is not, then press key message simulation is sent by the default script of execution clicks on confirmation upgrade event, carry out mandatory upgrade.
Preferably, the mobile terminal also includes verification unit;
The verification unit is used for:
Before the mobile terminal carries out mandatory upgrade, obtain the second edition that downloads intended application the One check code;
Obtain the second check code of the intended application in the second edition for locally pre-saving;
Judge whether the first check code is identical with second check code, if identical, just execute to enter the mobile terminal The step of row mandatory upgrade.
As can be seen from the above technical solutions, the embodiment of the present invention has advantages below:
By the first version information of mounted intended application in acquisition mobile terminal, Yi Jicong in the embodiment of the present invention Server obtains intended application upgrade information in the server, if first version information is different from second edition information, and the The escalation policy of the intended application of two versions is mandatory upgrade, then download the intended application of the second edition from server, and to moving Dynamic terminal carries out mandatory upgrade.Different escalation policys are configured to different application in the server in the present embodiment, some are gone out The application version of existing serious problems, configures mandatory upgrade, no longer needs human intervention and for whether in whole escalation process Mandatory upgrade can be configured by server, it is to avoid current application upgrade strategy is single, and some appearance are serious The application version user of problem is not upgraded, and cause cannot normally using application or leaking data the problems such as, improve should With the security and convenience that use.
Description of the drawings
Fig. 1 is one embodiment schematic diagram of the method for application upgrade in the embodiment of the present invention;
Fig. 2 is another embodiment schematic diagram of the method for application upgrade in the embodiment of the present invention;
Fig. 3 is one embodiment schematic diagram of the ambient condition for checking mobile terminal current network in the embodiment of the present invention;
Fig. 4 is one embodiment schematic diagram of step 102 in the embodiment of the present invention;
Fig. 5 is one embodiment schematic diagram for carrying out mandatory upgrade in the embodiment of the present invention in mobile terminal;
Fig. 6 is one embodiment schematic diagram of mobile terminal in the embodiment of the present invention;
Fig. 7 is another embodiment schematic diagram of mobile terminal in the embodiment of the present invention.
Specific embodiment
In order that those skilled in the art more fully understand the present invention program, below in conjunction with the embodiment of the present invention in Accompanying drawing, to the embodiment of the present invention in technical scheme be clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, rather than whole embodiments.Embodiment in based on the present invention, ordinary skill people The every other embodiment obtained under the premise of creative work is not made by member, should all belong to the model of present invention protection Enclose.
A kind of method of application upgrade is disclosed in the embodiment of the present invention, and in the embodiment of the present invention, method arbitrarily can moved Realize in dynamic terminal, mobile terminal can be for example:The electronic equipments such as mobile phone, panel computer, can also be that other have networking Function, is provided with the mobile terminal of application, and the mobile terminal embodiment of the present invention for implementing not is limited, as shown in figure 1, should One embodiment of method includes:
101st, the first version information of in the mobile terminal mounted intended application is obtained;
102nd, upgrade information of the intended application in the server is obtained from server, wrap in the upgrade information Include the upgrading plan of the intended application of second edition information and the second edition of the intended application in the server Slightly;
In the embodiment of the present invention, for the escalation policy of server application, including common upgrading and two kinds of sides of mandatory upgrade Formula, common upgrading need user to confirm upgrading according to described below, and mandatory upgrade does not need user to confirm, directly rises Level.
103rd, judge whether the first version information is identical with the second edition information;
If the 104 first version information are different from the second edition information, and the intended application of the second edition Escalation policy be mandatory upgrade, then download the intended application of the second edition from the server, and according to the upgrading Strategy carries out mandatory upgrade to the mobile terminal.
By the first version information of mounted intended application in acquisition mobile terminal, Yi Jicong in the embodiment of the present invention Server obtains intended application upgrade information in the server, if first version information is different from second edition information, and the The escalation policy of the intended application of two versions is mandatory upgrade, then download the intended application of the second edition from server, and moving Dynamic terminal carries out mandatory upgrade.Different escalation policys are configured to different application in the server in the present embodiment, some are gone out The application version of existing serious problems, configures mandatory upgrade, no longer needs human intervention and for whether in whole escalation process Mandatory upgrade can be configured by server, it is to avoid current application upgrade strategy is single, and some appearance are serious The application version user of problem is not upgraded, and cause cannot normally using application or leaking data the problems such as, improve should With the security and convenience that use.
Further, as shown in Fig. 2 method described in some embodiments of the invention can also include:
If the 105 first version information are different from the second edition information, and the intended application of the second edition Escalation policy be common upgrading, then detect whether the finger for getting the intended application that user confirms to install the second edition Order;
If 106 instructions for getting the intended application that user confirms to install the second edition, under the server The intended application of the second edition is carried, and is directly installed.
So, when the escalation policy in the intended application of the second edition is common upgrading, if getting user's confirmation The instruction of the intended application of the second edition is installed, under refer the intended application of the second edition and directly installed, it is to avoid After user clicks confirmation upgrading, after installation file is downloaded, also need to click on the process that installs manually, improve upgrading effect Rate, improves Consumer's Experience.
Optionally, in embodiments of the present invention, the first version of mounted intended application in the mobile terminal is obtained The step of information can be application start-up course carry out, or preset proof cycle (such as morning every night, Presumption user do not use mobile terminal) to application detect when carry out, can also be meeting some setting triggering bars Carry out during part, for example, during mobile terminal connection Wi-Fi, user clicks on the application house keeper in mobile terminal, and access can be upgraded During application etc., it is, of course, also possible to concurrently set above-mentioned one or more mode obtain, for example, enter in application start-up course every time The capable step, is also carried out the step, and does not use movement in presumption of daily morning user when user connects Wi-Fi every time The step etc. is carried out during terminal, is not construed as limiting herein.
Preferably, the step of obtaining the first version information of mounted intended application in the mobile terminal can be Carry out in application start-up course, so ensure that application can go to detect whether current application is full when startup every time Sufficient server version is required.There can be certain guarantee to the ageing of application upgrade.
In the embodiment of the present invention, the first version of in the mobile terminal mounted intended application is obtained in step 101 The specific implementation of information can be as follows:
When the system of mobile terminal is android system, it is merely able to pass through in android system GetPackageManager functions can just get the bag manager object PackageManager of current system, wherein GetPackageManager is the method that an acquisition system of android system body assures reason object.
The getPackageInfo functions in bag manager PackageManager are called to return current goal application program In packet-related information structure PackageInfo.It is related that the destination application is stored in PackageInfo structures Version information etc..
The versionName functions in PackageManager are called just to get the version of current goal application program This number information.Wherein versionName functions are to return the current application version information in reported information, the i.e. embodiment of the present invention In first version information.
The first version letter for obtaining mounted intended application in the mobile terminal is understood by above-mentioned execution flow process The process of breath, for follow-up citing description conveniently, is localVersion by current first version information flag.
Further, the step of the first version information of mounted intended application in the mobile terminal is obtained be In application start-up course when carrying out, then the first version information of mounted intended application in the acquisition mobile terminal Before step, in addition it is also necessary to first check the ambient condition of mobile terminal current network, the environment shape of mobile terminal current network is judged State is Wi-Fi or mobile network's state.
As shown in figure 3, checking that the ambient condition of mobile terminal current network can further include:
301st, network connection management class in mobile terminal is obtained;
When the system of mobile terminal is Android (Android) system, network connection management class can be ConnectivityManager, ConnectivityManager are one of Android offers and connect dedicated for network is obtained Connect the help class file of controlled state.The related connection state of system can be obtained by ConnectivityManager.Peace System offer is got by calling context.getSystemService functions in tall and erect (Android) system ConnectivityManager manages class.
302nd, network description scheme body is obtained by the network connection management class;
When the system of mobile terminal is Android (Android) system, network description scheme body can be NetworkInfo, the NetworkInfo network information description scheme body predominant package current network connection state of system.Logical Cross and call getActiveNetworkInfo functions to get NetworkInfo network information description scheme bodies.Wherein Current network information description scheme body NetworkInfo can be returned by getActiveNetworkInfo functions.
303rd, judge by the network connection function in the network description scheme body that the current network of mobile terminal connects Connect state.
When mobile terminal system be Android (Android) system when, by NetworkInfo in isConnected Function judging current network connection state,
If isConnected functions return true (true), illustrate to be currently at network connection state.
If isConnected functions return false (vacation), illustrate to be currently at network off-state.
If network can carry out the judgement of network type in connection status next step, if current network is in disconnection shape State can directly stop whole escalation process.Because without software upgrading renewal process cannot be carried out under network state.
Furthermore it is possible to getTypeName functions in by NetworkInfo are judging current network type.Wherein What getTypeName functions were returned is a character string, and the concrete value for returning is as follows:
WIFI:Represent that current network conditions are Wi-Fi states.
MOBILE:Represent that current network conditions are 2G/3G/4G states, the state shows that current network conditions are mobile networks Network state.
The difference of the type that can be returned by getTypeName judge the ambient condition of current network be Wi-Fi also It is mobile network's state.
Further, as shown in figure 4, in embodiments of the present invention, answering from the server acquisition target in step 102 The upgrade information being used in the server, may further include:
1021st, the request of the intended application upgrade information is sent to the server;
1022nd, the upgrade information of JSON form that the server return is received;
Wherein, the upgrade information of the JSON forms includes the second edition information field of the intended application, described The escalation policy field of the intended application of the second edition, the download address field of the intended application of the second edition, Yi Jisuo State the check code field of the intended application of the second edition.
Specifically, the upgrade information from the server acquisition intended application in the server in step 102 can To be:
By HTTP, to the second edition information of server request intended application, (i.e. intended application exists intended application client Version information in server), the second edition information that server is returned is to return to intended application by JSON formatted files Client.Intended application client judges escalation policy by parsing JSON formatted files.
For example, the following institute of the JSON data format definitions of the second edition information return of the intended application that server is returned Show:
Each field above-mentioned is illustrated:
version:The version information of application program in server.In order to subsequent descriptions facilitate mark to parse Version is serverVersion.
updateState:The escalation policy that server is returned, in this programme, upgrade status are divided into 2 types, the first The common escalation policys of normal, which two is force mandatory upgrade strategies.In order to subsequent descriptions facilitate mark to parse UpdateState is serverUpdateState.
url:The download address of application program, that is, mobile terminal is subsequently downloaded the download file address of flow process, The url for parsing is marked in the embodiment of the present invention for serverUrl in order to subsequent descriptions facilitate.
md5:The md5 check codes of upgrade application APK file, for verifying the integrality for downloading file.For subsequent descriptions Facilitate the md5 that parses is marked in the embodiment of the present invention is serverMd5.
As JSON is a kind of general network transmission format, belong to the prior art of a routine, the embodiment of the present invention Middle mobile terminal can be made after the JSON formatted files of the second edition information got comprising intended application in the server The JSON formatted files are parsed with general FastJson.By each the field information solution in the JSON character strings Separate out, you can obtain the second edition information of intended application, the escalation policy of the intended application of the second edition, described the The download address of the intended application of two versions, check code field of the intended application of the second edition etc..
The first version information of intended application is got in mobile terminal is local, and gets target in server answer After second edition information, need the whether identical of first version information and second edition information compared, continue with mobile eventually As a example by holding as android system, a kind of specific alignments are as follows:
Size comparison is carried out to localVersion the and serverVersion version numbers of above-mentioned acquisition, wherein LocalVersion and serverVersion version numbers are integers.
If localVersion<ServerVersion, then illustrate that local version number is less than server version number, this Need to carry out upgrading processing when individual.
If localVersion>=serverVersion, then illustrate local version number bigger than server version number or Person is equal to server version number, need not carry out upgrading processing this when.
If finding no need for carrying out upgrading processing after the comparison of first version information and second edition information, now may be used To enter directly into application main interface, follow-up updating operation flow process will not be carried out.
If finding to need to carry out upgrading processing now after the comparison of first version information and second edition information, need A judgement is further carried out to escalation policy.Specific determination methods are by parsing in above-mentioned steps ServerUpdateState field informations are being judged.
If the value of serverUpdateState fields is normal, show to use common upgrading mode to enter Row upgrading processing.
If the value of serverUpdateState fields is force, show to use mandatory upgrade mode to carry out Upgrading processing.
After above-mentioned determination mobile terminal needs escalation target application, if judging that current network state is mobile network before In the case of network (i.e. 2/3/4G network states), eject a prompting frame and inform that user's current network conditions are 2/3/4G network rings Border, downloads and will expend certain flow, if confirm to download.If user clicks on and downloads under 2/3/4G network environments Intended application down operation can be carried out, terminates the flow process that downloads if user clicks on and cancels.If being currently WIFI network ring Then directly open when under border and download intended application.
In the embodiment of the present invention, after the completion of the file download of intended application, in order to ensure the integrality of file, go back herein Verification code check can be carried out to file, therefore, before the step of carrying out mandatory upgrade to the mobile terminal, the side Method also includes:
Obtain the first check code of the intended application of the second edition that downloads;
Obtain the second check code of the intended application in the second edition for locally pre-saving;
Judge whether the first check code is identical with second check code, if identical, just execute to enter the mobile terminal The step of row mandatory upgrade.
Illustrated with MD5 checking procedures below.Specific file MD5 checking procedures are as follows:
(1) MessageDigest is obtained;
MessageDigest classes are the classes of the acquisition file MD5 information that android system is supplied to developer, lead to The function of crossing MessageDigest classes can effectively get the MD5 information of file.
The concrete MessageDigest methods that obtain are to get system offer by the constructed fuction of MessageDigest MessageDigest example.
(2) update methods are called;
Get update methods in the example in MessageDigest to obtain the MD5 information of file.Wherein Update methods are mainly data processing function, can return corresponding MD5 values if update has been processed after data.
(3) the MD5 information of file is obtained;
Corresponding MD5 value informations can just be got by the update methods in (2nd) step, in the embodiment of the present invention The MD5 values for getting can be labeled as localMd5.
If MD5 is verified successfully, illustrate that whole intended application downloading process has been completed.Follow-up act for convenience Example description, herein by the file mark that has downloaded be downloadApk.
Further, as shown in figure 5, described the step of the mobile terminal carries out mandatory upgrade in step 104, tool Body includes:
501st, detect whether the mobile terminal has superuser right, if so, then execution step 502, if it is not, then holding Row step 503;
502nd, the mandatory upgrade that is mourned in silence in the mobile terminal by the superuser right;
503rd, press key message simulation is sent by the default script of execution and clicks on confirmation upgrade event, carry out mandatory upgrade.
In android system, superuser right is root authority, and therefore the judgement detection in step 501 is described Whether mobile terminal has superuser right, that is, judge whether current mobile terminal environment is root environment, if root Environment then subsequently directly can carry out upgrading of mourning in silence, if being that non-root environment can realize liter automatically by script mode Level.
In android system, judge whether that the mode with root authority is as follows:
(1) su orders are executed
Su orders are executed, and it is Runtime.getRuntime () .exec (" su order concrete modes to be executed by code su");This function means and go to execute su orders by the runtime environment that system is provided.
Wherein su orders represent the meaning for obtaining root authority in Linux system, if the expression that runs succeeded can be obtained Get the root authority of system.If su is executed unsuccessfully represents the root authority that cannot get system.
Runtime.getRuntime () .exec (" su ") this function can return the example of a Process after executing, What this Process example was represented is the process for currently executing su.
(2) return value of su orders is read
This step mainly obtains the return value after su is executed, and needs to obtain the return value after su is executed firstly the need of wait Process is executed and is completed, and specifically calls the waiteFor functions in Process.
Whether waiteFor functions mainly detection procedure executes and completes, if executed to be returned to execute the knot for completing Really, if being not carried out completing waitFor functions can wait until that execution completes just to return always.The knot that will be returned for convenience Fruit is labeled as result.
(3) judged whether with root authority according to returning result
Can judge according to the return value of result whether su orders run succeeded.If the expression that runs succeeded has Root authority, do not possess root authority if being not carried out successfully representing.
If result=0, represent that the execution of su orders is successful, now illustrate that the system is that possess to have root authority 's.
If result!=0, represent that su order execution have failed, now illustrate that the system does not possess root authority.
The pm orders that can be provided by calling system for the mobile terminal with root authority are realizing the quiet of backstage Silent installation.Pm orders are the lives dedicated for installation and debugging bag when debugging utility that android system is provided Order, can realize the upgrading flow process of mourning in silence on application program backstage by the execution of the order.And for the shifting without root authority Dynamic terminal, then can not call pm order realizations to mourn in silence mandatory upgrade.
The mode that there is to the application upgrade with root authority and not the application upgrade of root authority separately below is carried out Introduce:
1st, there is the application upgrade of root authority:
(1) path for downloading file is obtained
The download path of file has been saved when download module is downloaded, and can be protected with direct access at that time herein The data that deposits.
It is downloadApk by the concrete download path of the file of the preservation of above-mentioned download module.
(2) execute PM orders to be installed
Carry out installation APK file by executing Pm orders, Pm orders be one of android system offer dedicated for The order of installation and debugging bag when debugging utility, can realize mourning in silence for application program backstage by the execution of the order Upgrading flow process.
The specifically used mode of Pm is as follows:
Pm install-f downloadAPk
Next above-mentioned installation order is explained in detail:
Pm:The order of installation
Install:Expression needs to execute installation operation
-f:Solar obligation is represented, if the APK is fitted without in original system, then directly can be installed, if former To have existed for the APK in system, then the version for covering original installation can be forced.
DownloadApk:Representing concrete needs mounted apk files.
The execution of above-mentioned pm orders is executed by investigating Runtime.getRuntime () .exec () function , Runtime.getRuntime () .exec () function has had related description above, no longer illustrates herein.
(3) installation results feedback
The return value executed in current life can be obtained by calling waiteFor functions.If return value is equal to 0 table Show and run succeeded, if return value is not equal to 0 expression and executes failure.
This deterministic process is similar with above-mentioned su implementation procedures, no longer describes in detail herein.
2nd, there is no the application upgrade of root authority:
Due under non-root environment be cannot calling system pm orders realizing mandatory upgrade, in this case, Click event is simulated by way of press key message is sent by script in the embodiment of the present invention realizes upgrading flow process automatically.Also It is to say that will be previously required to people goes the process for executing to be simulated click event by the form of script transmission press key message, so as to Reach the purpose of automatic escalation target application.
Specific implementation is as follows:
In Android, system is sent out there is provided an Instrumentation interface mould from and send press key message, wherein has One sendKeyDownUpSync function, this function major function are to send a key information to mobile phone terminal.
One key information is described by MotionEvent in Android, is wrapped in MotionEvent Coordinate information and key-press event information containing button.That is is contained in this structure of MotionEvent a time All description informations.
So just MotionEvent can be delivered to by sendKeyDownUpSync in the embodiment of the present invention Certain point on system interface is can be realized as in sendKeyDownUpSync functions sends a press key message.
Know how to send key commands to system by description above, now can be with the embodiment of the present invention Operating process further according to execution of entirely upgrading is sending corresponding key information.
Constantly sent key information to simulate people as screen according to manually operated flow model by such mode During manual operation.The purpose for installing automatically upgrading APK is reached by such mode.
In the embodiment of the present invention, after installation targets application, in addition it is also necessary to detect whether intended application is installed successfully.This step In detect whether that it is to judge that intended application is currently installed on whether version information is changed into needing to rise in server to install successful mode The version information (i.e. the second edition information of intended application) of level.
The current version information of installation file is read by method previously and is passed over server File version information is contrasted, if identical explanation is upgraded successfully.If unequal explanation upgrading failure, meanwhile, will upgrading Result phase feeds back to server, and the feedback of this result phase generally refers to upgrade successfully or the result of failure is fed back Server end is arrived, convenient service is to upgrading successfully or the result of failure carries out statistical disposition.Due to hereinbefore all detailed Describe.Updating result state is passed by http protocol Be delivered to server, mainly convenient service device carrying out statistics success rate for upgrading, for improvement or the operation people of later stage scheme The demand of member has certain help.
In the embodiment of the present invention, user can be pointed out to be upgraded manually in intended application upgrading failure, or be continued The method for carrying out once above-mentioned application upgrade again.
The embodiment of mobile terminal in the embodiment of the present invention is described below.
Fig. 6 is referred to, is one embodiment schematic diagram of mobile terminal in the embodiment of the present invention, the mobile terminal 600 is wrapped Include:
Version information acquiring unit 601, for obtaining the first version of mounted intended application in the mobile terminal Information;
Upgrade information acquiring unit 602, for obtaining upgrading of the intended application in the server from server Information, the upgrade information include second edition information and the second edition of the intended application in the server The escalation policy of this intended application, the escalation policy that applies in the server include common upgrading and mandatory upgrade;
Judging unit 603, for judging whether the first version information is identical with the second edition information;
Upgrade unit 604, if different from the second edition information for the first version information, and the second edition The escalation policy of this intended application is mandatory upgrade, from the intended application that the server downloads the second edition, and root Mandatory upgrade is carried out according to the escalation policy in the mobile terminal.
Further, the upgrade unit 604 is additionally operable to:
If the first version information is different from the second edition information, and the liter of the intended application of the second edition Level strategy is common upgrading, then detect whether the instruction for getting the intended application that user confirms to install the second edition;
If getting the instruction of the intended application that user confirms to install the second edition, institute is downloaded from the server The intended application of the second edition is stated, and is directly installed.
Further, the upgrade information acquiring unit 602 specifically for:
To the request that the server sends the intended application upgrade information;
Receive the upgrade information of the JSON forms that the server is returned;
Wherein, the upgrade information of the JSON forms includes the second edition information field of the intended application, described The escalation policy field of the intended application of the second edition, the download address field of the intended application of the second edition, Yi Jisuo State the check code field of the intended application of the second edition.
Further, the upgrade unit 604 specifically for:
Detect whether the mobile terminal has superuser right;
If so, the mandatory upgrade that is then mourned in silence in the mobile terminal by the superuser right;
If it is not, then press key message simulation is sent by the default script of execution clicks on confirmation upgrade event, carry out mandatory upgrade.
Further, such as Fig. 7, the mobile terminal 600 also includes verification unit 605;
The verification unit 605 is used for:
Before the mobile terminal carries out mandatory upgrade, obtain the second edition that downloads intended application the One check code;
Obtain the second check code of the intended application in the second edition for locally pre-saving;
Judge whether the first check code is identical with second check code, if identical, just execute to enter the mobile terminal The step of row mandatory upgrade.
Those skilled in the art can be understood that, for convenience and simplicity of description, the system of foregoing description, Device and the specific work process of unit, may be referred to the corresponding process in preceding method embodiment, will not be described here.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.Above-mentioned integrated list Unit both can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is realized and as independent production marketing or use using in the form of SFU software functional unit When, can be stored in a computer read/write memory medium.Such understanding is based on, technical scheme is substantially The part that in other words prior art is contributed or all or part of the technical scheme can be in the form of software products Embody, the computer software product is stored in a storage medium, use so that a computer including some instructions Equipment (can be personal computer, server, or network equipment etc.) executes the complete of each embodiment methods described of the invention Portion or part steps.And aforesaid storage medium includes:USB flash disk, portable hard drive, read-only storage (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can store journey The medium of sequence code.
The above, above example only in order to technical scheme to be described, rather than a limitation;Although with reference to front State embodiment to be described in detail the present invention, it will be understood by those within the art that:Which still can be to front State the technical scheme described in each embodiment to modify, or equivalent is carried out to which part technical characteristic;And these Modification is replaced, and does not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.

Claims (10)

1. a kind of method of application upgrade, it is characterised in that be applied to mobile terminal, methods described includes:
Obtain the first version information of mounted intended application in the mobile terminal;
Upgrade information of the intended application in the server is obtained from server, the upgrade information includes the mesh Mark applies the escalation policy of the intended application of second edition information and the second edition in the server, the clothes The escalation policy that applies in business device includes common upgrading and mandatory upgrade;
Judge whether the first version information is identical with the second edition information;
If the first version information is different from the second edition information, and the upgrading plan of the intended application of the second edition Slightly mandatory upgrade, then download the intended application of the second edition from the server, and according to the escalation policy to institute Stating mobile terminal carries out mandatory upgrade.
2. method according to claim 1, it is characterised in that methods described also includes:
If the first version information is different from the second edition information, and the upgrading plan of the intended application of the second edition The instruction of the slightly common intended application that upgrades, then detect whether to get that user confirms to install the second edition;
If getting the instruction of the intended application that user confirms to install the second edition, described the is downloaded from the server The intended application of two versions, and directly installed.
3. method according to claim 1 and 2, it is characterised in that described obtain the intended application in institute from server The step of stating the upgrade information in server, specifically includes:
To the request that the server sends the intended application upgrade information;
Receive the upgrade information of the JSON forms that the server is returned;
Wherein, the upgrade information of the JSON forms include the second edition information field of the intended application, described second The escalation policy field of the intended application of version, the download address field of the intended application of the second edition and described The check code field of the intended application of two versions.
4. method according to claim 1, it is characterised in that the step for carrying out mandatory upgrade to the mobile terminal Suddenly, specifically include:
Detect whether the mobile terminal has superuser right;
If so, the mandatory upgrade that is then mourned in silence in the mobile terminal by the superuser right;
If it is not, then press key message simulation is sent by the default script of execution clicks on confirmation upgrade event, carry out mandatory upgrade.
5. method according to claim 4, it is characterised in that described the step of carry out mandatory upgrade to the mobile terminal Before, methods described also includes:
Obtain the first check code of the intended application of the second edition that downloads;
Obtain the second check code of the intended application in the second edition for locally pre-saving;
Judge whether the first check code is identical with second check code, if identical, just executing is carried out by force to the mobile terminal The step of system upgrading.
6. a kind of mobile terminal, it is characterised in that include:
Version information acquiring unit, for obtaining the first version information of mounted intended application in the mobile terminal;
Upgrade information acquiring unit, for obtaining upgrade information of the intended application in the server, institute from server Stating upgrade information includes the mesh of second edition information and the second edition of the intended application in the server The escalation policy of mark application, the escalation policy that applies in the server include common upgrading and mandatory upgrade;
Judging unit, for judging whether the first version information is identical with the second edition information;
Upgrade unit, if different from the second edition information for the first version information, and the mesh of the second edition The escalation policy of mark application is mandatory upgrade, from the intended application that the server downloads the second edition, and according to described Escalation policy carries out mandatory upgrade to the mobile terminal.
7. mobile terminal according to claim 6, it is characterised in that the upgrade unit is additionally operable to:
If the first version information is different from the second edition information, and the upgrading plan of the intended application of the second edition The instruction of the slightly common intended application that upgrades, then detect whether to get that user confirms to install the second edition;
If getting the instruction of the intended application that user confirms to install the second edition, described the is downloaded from the server The intended application of two versions, and directly installed.
8. the mobile terminal according to claim 6 or 7, it is characterised in that the upgrade information acquiring unit specifically for:
To the request that the server sends the intended application upgrade information;
Receive the upgrade information of the JSON forms that the server is returned;
Wherein, the upgrade information of the JSON forms include the second edition information field of the intended application, described second The escalation policy field of the intended application of version, the download address field of the intended application of the second edition and described The check code field of the intended application of two versions.
9. mobile terminal according to claim 6, the upgrade unit specifically for:
Detect whether the mobile terminal has superuser right;
If so, the mandatory upgrade that is then mourned in silence in the mobile terminal by the superuser right;
If it is not, then press key message simulation is sent by the default script of execution clicks on confirmation upgrade event, carry out mandatory upgrade.
10. mobile terminal according to claim 9, it is characterised in that the mobile terminal also includes verification unit;
The verification unit is used for:
Before the mobile terminal carries out mandatory upgrade, the first school of the intended application of the second edition that downloads is obtained Test code;
Obtain the second check code of the intended application in the second edition for locally pre-saving;
Judge whether the first check code is identical with second check code, if identical, just executing is carried out by force to the mobile terminal The step of system upgrading.
CN201610948962.9A 2016-11-02 2016-11-02 A kind of method of application upgrade and mobile terminal Pending CN106502747A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610948962.9A CN106502747A (en) 2016-11-02 2016-11-02 A kind of method of application upgrade and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610948962.9A CN106502747A (en) 2016-11-02 2016-11-02 A kind of method of application upgrade and mobile terminal

Publications (1)

Publication Number Publication Date
CN106502747A true CN106502747A (en) 2017-03-15

Family

ID=58322168

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610948962.9A Pending CN106502747A (en) 2016-11-02 2016-11-02 A kind of method of application upgrade and mobile terminal

Country Status (1)

Country Link
CN (1) CN106502747A (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107092484A (en) * 2017-03-27 2017-08-25 武汉斗鱼网络科技有限公司 By the method and system of the function button information reporting to Java layers of C language layer
CN107451000A (en) * 2017-07-03 2017-12-08 杭州中天微系统有限公司 A kind of system upgrade detection method
CN107688462A (en) * 2017-04-10 2018-02-13 平安科技(深圳)有限公司 Method for upgrading software and front-end server
CN108076224A (en) * 2017-12-21 2018-05-25 广东欧珀移动通信有限公司 application control method, device and storage medium and mobile terminal
CN108920045A (en) * 2018-06-21 2018-11-30 上海二三四五网络科技有限公司 A kind of control method and control device of Fast Installation application program
CN109857441A (en) * 2019-02-19 2019-06-07 深圳供电局有限公司 A kind of method that mobile terminal and its APP software package cloud update
CN110768817A (en) * 2018-07-27 2020-02-07 视联动力信息技术股份有限公司 Upgrading method and device for video networking terminal
CN110780789A (en) * 2019-10-25 2020-02-11 腾讯科技(深圳)有限公司 Game application starting method and device, storage medium and electronic device
CN111045749A (en) * 2019-12-18 2020-04-21 青岛海信传媒网络技术有限公司 Application program starting method and device
CN111158719A (en) * 2019-12-26 2020-05-15 湖南快乐阳光互动娱乐传媒有限公司 Application software upgrading method and device
CN111427595A (en) * 2019-09-03 2020-07-17 杭州海康威视数字技术股份有限公司 Client upgrading method, device and system
CN111984286A (en) * 2020-07-15 2020-11-24 深圳拓邦股份有限公司 APP classified upgrading method
CN112202920A (en) * 2020-10-23 2021-01-08 上海擎感智能科技有限公司 Vehicle machine system upgrading method and device
CN113825157A (en) * 2021-05-13 2021-12-21 深圳市乙辰科技股份有限公司 Wireless network equipment upgrading method and system
CN113932383A (en) * 2020-07-13 2022-01-14 海信(山东)空调有限公司 Air conditioner and upgrading method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231880A (en) * 2011-07-04 2011-11-02 中兴通讯股份有限公司 Version upgrade method and terminal, and version upgrade system
CN102932778A (en) * 2012-10-29 2013-02-13 东莞宇龙通信科技有限公司 Method and system for wirelessly upgrading mobile phone terminal
CN103473085A (en) * 2013-08-22 2013-12-25 卓易畅游(北京)科技有限公司 Method and equipment for loading target application on mobile terminal
CN105183496A (en) * 2015-07-21 2015-12-23 浪潮软件集团有限公司 Method for automatically upgrading and pushing software based on domestic CPU and operating system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102231880A (en) * 2011-07-04 2011-11-02 中兴通讯股份有限公司 Version upgrade method and terminal, and version upgrade system
CN102932778A (en) * 2012-10-29 2013-02-13 东莞宇龙通信科技有限公司 Method and system for wirelessly upgrading mobile phone terminal
CN103473085A (en) * 2013-08-22 2013-12-25 卓易畅游(北京)科技有限公司 Method and equipment for loading target application on mobile terminal
CN105183496A (en) * 2015-07-21 2015-12-23 浪潮软件集团有限公司 Method for automatically upgrading and pushing software based on domestic CPU and operating system

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107092484A (en) * 2017-03-27 2017-08-25 武汉斗鱼网络科技有限公司 By the method and system of the function button information reporting to Java layers of C language layer
CN107688462A (en) * 2017-04-10 2018-02-13 平安科技(深圳)有限公司 Method for upgrading software and front-end server
WO2018188336A1 (en) * 2017-04-10 2018-10-18 平安科技(深圳)有限公司 Software upgrade method, front-end server and computer-readable storage medium
CN107451000B (en) * 2017-07-03 2021-03-02 杭州中天微系统有限公司 System upgrade detection method
CN107451000A (en) * 2017-07-03 2017-12-08 杭州中天微系统有限公司 A kind of system upgrade detection method
CN108076224A (en) * 2017-12-21 2018-05-25 广东欧珀移动通信有限公司 application control method, device and storage medium and mobile terminal
CN108076224B (en) * 2017-12-21 2021-06-29 Oppo广东移动通信有限公司 Application program control method and device, storage medium and mobile terminal
CN108920045A (en) * 2018-06-21 2018-11-30 上海二三四五网络科技有限公司 A kind of control method and control device of Fast Installation application program
CN110768817A (en) * 2018-07-27 2020-02-07 视联动力信息技术股份有限公司 Upgrading method and device for video networking terminal
CN110768817B (en) * 2018-07-27 2022-04-12 视联动力信息技术股份有限公司 Upgrading method and device for video networking terminal
CN109857441A (en) * 2019-02-19 2019-06-07 深圳供电局有限公司 A kind of method that mobile terminal and its APP software package cloud update
CN111427595A (en) * 2019-09-03 2020-07-17 杭州海康威视数字技术股份有限公司 Client upgrading method, device and system
CN111427595B (en) * 2019-09-03 2024-03-05 杭州海康威视数字技术股份有限公司 Client upgrading method, device and system
CN110780789A (en) * 2019-10-25 2020-02-11 腾讯科技(深圳)有限公司 Game application starting method and device, storage medium and electronic device
CN111045749A (en) * 2019-12-18 2020-04-21 青岛海信传媒网络技术有限公司 Application program starting method and device
CN111158719A (en) * 2019-12-26 2020-05-15 湖南快乐阳光互动娱乐传媒有限公司 Application software upgrading method and device
CN111158719B (en) * 2019-12-26 2023-06-16 湖南快乐阳光互动娱乐传媒有限公司 Application software upgrading method and device
CN113932383A (en) * 2020-07-13 2022-01-14 海信(山东)空调有限公司 Air conditioner and upgrading method
CN111984286A (en) * 2020-07-15 2020-11-24 深圳拓邦股份有限公司 APP classified upgrading method
CN112202920A (en) * 2020-10-23 2021-01-08 上海擎感智能科技有限公司 Vehicle machine system upgrading method and device
CN112202920B (en) * 2020-10-23 2023-12-29 上海擎感智能科技有限公司 Vehicle-mounted system upgrading method and device
CN113825157A (en) * 2021-05-13 2021-12-21 深圳市乙辰科技股份有限公司 Wireless network equipment upgrading method and system
CN113825157B (en) * 2021-05-13 2023-07-25 深圳市乙辰科技股份有限公司 Wireless network equipment upgrading method and system

Similar Documents

Publication Publication Date Title
CN106502747A (en) A kind of method of application upgrade and mobile terminal
CN108108297B (en) Method and device for automatic testing
US8612947B2 (en) System and method for remotely compiling multi-platform native applications for mobile devices
US8515876B2 (en) Dry-run design time environment
US20160283356A1 (en) Event-driven automation testing for mobile devices
US20170316209A1 (en) Method and device for preventing application in an operating system from being uninstalled
CN104766007A (en) Method for quickly recovering sandbox based on file system filter driver
CN114077423A (en) Airport APP development container architecture based on mobile cross-platform
US20100125758A1 (en) Distributed system checker
CN109753411A (en) Abnormality eliminating method, device, mobile terminal and storage medium
CN108089873A (en) A kind of method and terminal of application component immediate updating
CN109672553A (en) Gateway Dynamic Configuration, system, computer equipment and storage medium
CN110119350A (en) Software Development Kit test method, device and equipment and computer storage medium
CN108958785B (en) Application program upgrading method and device
CN112199284A (en) Program automation testing method and corresponding device, equipment and medium
CN105653934A (en) Mobile terminal and application protection method thereof
CN106020882A (en) Application upgrading method, intelligent terminal and upgrading system
CN105786636B (en) A kind of system repair and device
WO2021169124A1 (en) Method and apparatus for installing software package to target host, and computer device
CN107526584B (en) Data access method and device
CN108287720B (en) Software compiling method, device, equipment and storage medium
US11023220B2 (en) Firmware update with integrated smart sequence and action engine
CN112199283A (en) Program test control and execution method and corresponding device, equipment and medium
CN108734007A (en) A kind of processing method and processing device of monitoring application program
CN109918287A (en) APP upgrading test method, apparatus, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170315

RJ01 Rejection of invention patent application after publication