CN104123181A - Automatic data refreshing method and system when interface is switched to background for running - Google Patents

Automatic data refreshing method and system when interface is switched to background for running Download PDF

Info

Publication number
CN104123181A
CN104123181A CN201410326440.6A CN201410326440A CN104123181A CN 104123181 A CN104123181 A CN 104123181A CN 201410326440 A CN201410326440 A CN 201410326440A CN 104123181 A CN104123181 A CN 104123181A
Authority
CN
China
Prior art keywords
interface
data
module
server
specifying
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
CN201410326440.6A
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.)
SHENZHEN YUNZHOU MULTIMEDIA TECHNOLOGY Co Ltd
Original Assignee
SHENZHEN YUNZHOU MULTIMEDIA 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 SHENZHEN YUNZHOU MULTIMEDIA TECHNOLOGY Co Ltd filed Critical SHENZHEN YUNZHOU MULTIMEDIA TECHNOLOGY Co Ltd
Priority to CN201410326440.6A priority Critical patent/CN104123181A/en
Publication of CN104123181A publication Critical patent/CN104123181A/en
Pending legal-status Critical Current

Links

Landscapes

  • Telephonic Communication Services (AREA)

Abstract

The invention discloses an automatic data refreshing method and system when an interface is switched to a background for running. According to the method, a monitor is added and monitors the specified interface which executes the On Resume () method and the On Stop () method; when the specified interface executes the On Stop () method, whether the specified interface is equal to the interface of the On Resume () method or not is judged, and if yes, it shows that the specified interface is located in the background; when the On Resume () method is switched into once more, an HTTP request is sent to a server to request for data, and the method that once the specified interface is located in the background and then located in a foreground, the data are refreshed is achieved. The problem that in the prior art, because a home key can not be monitored, when the interface is switched to the background for running, whether the data related to the interface are updated or not can not be detected, and the data content presented on the interface can not be updated in real time is solved.

Description

A kind of interface is switched to the method and system of the automatic refresh data of running background
Technical field
The present invention relates to Refresh Data technical field, relate in particular to the method and system that a kind of interface is switched to the automatic refresh data of running background.
Background technology
In android, Activity has four kinds of basic status:
1.Active/Runing
After a new Activity startup is stacked, it is presented at screen foremost, processing is the top (Activity stack top) in stack, now it in visible and can with the state of activation of user interactions, be called active state or running status (active or running).
2.Paused
When Activity loses focus, by a new non-full frame Activity or a transparent Activity, be placed on stack top, state is now called halted state (Paused).Now it still keeps being connected with window manager, and Activity still maintains vigour (keep all states, information about firms, keeps being connected with window manager), but will be stopped by force when Installed System Memory is extremely low.So it is still visible, therefore but lost focus and can not carry out alternately with user.
3.Stoped
If an Activity is override completely by other Activity, be called halted state (Stopped).It still keeps all states and information about firms, but it is no longer visible, so its window is hidden, when Installed System Memory need to be used in other local time, the Activity of Stopped will be stopped by force.
4.Killed
If an Activity is Paused or Stopped state, system can be deleted this Activity from internal memory, and Android system is adopted in two ways and deleted, or requires this Activity to finish, or directly stops its process.When this Activity is shown to user again, the state that it must restart and reset above.
After Android4.0, developer can not monitor and shield Home key, for KEYCODE_HOME, what official provided is described below: so Home key.This key is handled by the framework and is never delivered to applications., unless revised Framework, all can not directly monitor Home key; If monitor Log daily record, but by Home key, is not show Log daily record now, even and different mobile phone models show also can be the same.
In android, each Activity will carry out OnResume () method when starting, and each Activity will carry out OnStop method when being moved to end, and user Activity after by Home key will carry out Onstop () method.Therefore, in the prior art, generally adopt in the OnStop of each Activity () method, judge the state of all Activity, when if all Activity are sightless (all carrying out OnStop ()), just carry out the operation feeling like doing.But, when Application Program Interface many, while wishing to be again cut into foreground at appointment interface again in backstage, with regard to request server refresh data, a lot of application programs all need to monitor the life that HOME key is carried out ACTIVITY, but cannot realize the function of server refresh data.
Because prior art can not be monitored home key, when interface is switched to running background, even if the relevant data content in the interface of storing on server has interpolation, deletion and modification, when being cut into foreground again, interface but cannot automatically upgrade, and make the data content that interface presents cannot realize real-time update.
Summary of the invention
The object of the embodiment of the present invention is to propose a kind of method that interface is switched to the automatic refresh data of running background, be intended to solve prior art and can not monitor home key, while causing interface to be switched to running background, cannot survey interface related data and whether upgrade, thereby cannot realize the problem of the data content real-time update that interface presents.
The embodiment of the present invention is achieved in that a kind of interface is switched to the method for the automatic refresh data of running background, said method comprising the steps of:
Set up a listener, for monitoring the state of specifying interface;
It is visible setting and specifying interface;
When listening to while specifying interface invisible, carry out OnStop () method;
Continue to monitor, when listening to while specifying interface visible, carry out OnResume () method, and send http request, request server upgrades the appointment interface related data of its storage;
Judge whether the described appointment interface related data of storing in server has renewal, if there is renewal, refreshes and specify interface related data to show; If do not upgrade, do not deal with.
Another object of the embodiment of the present invention is to propose the system that a kind of interface is switched to the automatic refresh data of running background, and described system comprises mobile terminal and server;
Mobile terminal comprises:
Monitor module, for setting up a listener, for monitoring the state of specifying interface;
Visible interface setting module, specifies interface for visible for setting;
Specify interface, for the current state of setting is visible user interface;
OnStop () method execution module, for when listening to while specifying interface invisible, carries out OnStop () method;
OnResume () method execution module, for when listening to while specifying interface visible, carries out OnResume () method;
Data Update request sending module, for sending http request, request server upgrades the appointment interface related data of its storage;
Data Update situation acquisition module, judges to specify interface related data whether to have renewal for call server, and the relevant Data Update situation in the appointment interface of reception server feedback;
Interface data refresh module, for when knowing that appointment interface related data that server is stored has renewal, refreshes mobile terminal and specifies the related data in interface;
Server comprises:
Data memory module, specifies interface related data for storing;
Message processing module, the http request of the more new data sending for mobile terminal receive, and announcement server data update module starts to carry out; And the call server sending for mobile terminal receive judges the request of specifying interface related data whether to have renewal, and notification data update status judge module is carried out, and for receiving the judged result of Data Update situation judge module feedback, described judged result is sent to mobile terminal;
Server data update module, for specifying interface related data according to the update notifications of message processing module;
Data Update situation judge module, for judging according to the notice of message processing module whether the described appointment interface related data that server is stored has renewal, and sends to message processing module by judged result.
Beneficial effect of the present invention
The present invention discloses a kind of method that interface is switched to the automatic refresh data of running background, by adding a listener, monitor and specify interface to carry out OnResume () and OnStop (), when specifying interface to carry out onStop (), judge whether to equal that interface of onResume (), if just represent to specify interface, be in backstage, so ought be cut into again OnResume (), send HTTP and ask server request data, once realize when specifying interface in backstage, method in foreground refresh data again, also can indirectly realize an excuse in B listener simultaneously, the monitoring of HOME key is pressed in realization.
Accompanying drawing explanation
Fig. 1 is the method flow diagram that a kind of interface of the preferred embodiment of the present invention is switched to the automatic refresh data of running background;
Fig. 2 is the system construction drawing that a kind of interface of the preferred embodiment of the present invention is switched to the automatic refresh data of running background.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated, for convenience of explanation, only show the part relevant to the embodiment of the present invention.Should be appreciated that the specific embodiment that this place is described, only for explaining the present invention, not in order to limit the present invention.
The embodiment of the present invention discloses a kind of method that interface is switched to the automatic refresh data of running background, by adding a listener, monitor and specify interface to carry out OnResume () and OnStop (), when specifying interface to carry out onStop (), judge whether to equal that interface of onResume (), if just represent to specify interface, be in backstage, so ought be cut into again OnResume (), send HTTP and ask server request data, once realize when specifying interface in backstage, method in foreground refresh data again, also can indirectly realize an excuse in B listener simultaneously, the monitoring of HOME key is pressed in realization.
Embodiment mono-
Fig. 1 is the method flow diagram that a kind of interface of the preferred embodiment of the present invention is switched to the automatic refresh data of running background; Said method comprising the steps of:
S101, sets up a listener, for monitoring the state of specifying interface;
The state at described appointment interface comprises visible and invisible;
S102, it is visible setting and specifying interface;
S103, when listening to while specifying interface invisible, carries out OnStop () method;
The method of judging described appointment interface invisible (specifying interface in running background) as:
First specify interface to carry out onResume () method, then monitor and specify interface to carry out OnResume () and OnStop () method; When specifying interface to carry out onStop () method, interface when whether judgement now specifies interface to equal to specify interface to carry out onResume (), if so, represents to specify interface in backstage.
In this step (step S103), only have when listening to while specifying interface invisible, just do relevant treatment; If specify interface visible, do not process, just continue to monitor.
S104, continue to monitor, and when listening to while specifying interface visible, carries out OnResume () method, and sends http request, and request server upgrades the appointment interface related data of its storage;
In this step (step S104), only have when listening to while specifying interface visible, just do relevant treatment; If specify interface invisible, do not process, just continue to monitor.
S105, judges whether the described appointment interface related data of storing in server has renewal, if there is renewal, refreshes and specifies interface related data to show; If do not upgrade, do not deal with.
Suppose that described appointment interface is that a certain broadcast interface in Android player (being called the first broadcast interface) is specifically described above step below:
First create an eavesdropping target, whether visible for monitoring the first broadcast interface, when monitoring the first broadcast interface when invisible, carry out OnStop () method (telling that listener the first broadcast interface is invisible);
Continue to monitor, when listening to the first broadcast interface when visible, carry out OnResume () method (telling that listener the first broadcast interface is visible), and send http request, request server upgrades the broadcast program data of described first broadcast interface of its storage;
Whether the broadcast program data that then judge described the first broadcast interface of storing on server have renewal, if there is renewal, upgrade the broadcast program data in the first broadcast interface; If without renewal, do not deal with.
Embodiment bis-
Fig. 2 is the system construction drawing that a kind of interface of the preferred embodiment of the present invention is switched to the automatic refresh data of running background.Described system comprises mobile terminal and server;
Mobile terminal comprises:
Monitor module, for setting up a listener, for monitoring the state of specifying interface;
Visible interface setting module, specifies interface for visible for setting;
Specify interface, for the current state of setting is visible user interface;
OnStop () method execution module, for when listening to while specifying interface invisible, carries out OnStop () method;
OnResume () method execution module, for when listening to while specifying interface visible, carries out OnResume () method;
Data Update request sending module, for sending http request, request server upgrades the appointment interface related data of its storage;
Data Update situation acquisition module, judges to specify interface related data whether to have renewal for call server, and the relevant Data Update situation in the appointment interface of reception server feedback;
Interface data refresh module, for when knowing that appointment interface related data that server is stored has renewal, refreshes mobile terminal and specifies the related data in interface;
Server comprises:
Data memory module, specifies interface related data for storing;
Message processing module, the http request of the more new data sending for mobile terminal receive, and announcement server data update module starts to carry out; And the call server sending for mobile terminal receive judges the request of specifying interface related data whether to have renewal, and notification data update status judge module is carried out, and for receiving the judged result of Data Update situation judge module feedback, described judged result is sent to mobile terminal;
Server data update module, for specifying interface related data according to the update notifications of message processing module;
Data Update situation judge module, for judging according to the notice of message processing module whether the described appointment interface related data that server is stored has renewal, and sends to message processing module by judged result;
Those having ordinary skill in the art will appreciate that, the all or part of step realizing in above-described embodiment method can complete by programmed instruction related hardware, described program can be stored in a computer read/write memory medium, and described storage medium can be ROM, RAM, disk, CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.

Claims (6)

1. interface is switched to a method for the automatic refresh data of running background, it is characterized in that, said method comprising the steps of:
Set up a listener, for monitoring the state of specifying interface;
It is visible setting and specifying interface;
When listening to while specifying interface invisible, carry out OnStop () method;
Continue to monitor, when listening to while specifying interface visible, carry out OnResume () method, and send http request, request server upgrades the appointment interface related data of its storage;
Judge whether the described appointment interface related data of storing in server has renewal, if there is renewal, refreshes and specify interface related data to show; If do not upgrade, do not deal with.
2. interface as claimed in claim 1 is switched to the method for the automatic refresh data of running background, it is characterized in that, the state at described appointment interface comprises visible and invisible.
3. interface as claimed in claim 1 is switched to the method for the automatic refresh data of running background, it is characterized in that, judge the sightless method in described appointment interface as:
First specify interface to carry out onResume () method, then monitor and specify interface to carry out OnResume () and OnStop () method; When specifying interface to carry out onStop () method, interface when whether judgement now specifies interface to equal to specify interface to carry out onResume (), if so, represents to specify interface in backstage.
4. interface as claimed in claim 1 is switched to the method for the automatic refresh data of running background, it is characterized in that, judges that described appointment interface is as the interface in Android player.
5. interface is switched to a system for the automatic refresh data of running background, it is characterized in that, described system comprises mobile terminal and server;
Mobile terminal comprises:
Monitor module, for setting up a listener, for monitoring the state of specifying interface;
Visible interface setting module, specifies interface for visible for setting;
Specify interface, for the current state of setting is visible user interface;
OnStop () method execution module, for when listening to while specifying interface invisible, carries out OnStop () method;
OnResume () method execution module, for when listening to while specifying interface visible, carries out OnResume () method;
Data Update request sending module, for sending http request, request server upgrades the appointment interface related data of its storage;
Data Update situation acquisition module, judges to specify interface related data whether to have renewal for call server, and the relevant Data Update situation in the appointment interface of reception server feedback;
Interface data refresh module, for when knowing that appointment interface related data that server is stored has renewal, refreshes mobile terminal and specifies the related data in interface;
Server comprises:
Data memory module, specifies interface related data for storing;
Message processing module, the http request of the more new data sending for mobile terminal receive, and announcement server data update module starts to carry out; And the call server sending for mobile terminal receive judges the request of specifying interface related data whether to have renewal, and notification data update status judge module is carried out, and for receiving the judged result of Data Update situation judge module feedback, described judged result is sent to mobile terminal;
Server data update module, for specifying interface related data according to the update notifications of message processing module;
Data Update situation judge module, for judging according to the notice of message processing module whether the described appointment interface related data that server is stored has renewal, and sends to message processing module by judged result.
6. interface as claimed in claim 5 is switched to the system of the automatic refresh data of running background, it is characterized in that, in described OnStop () method execution module, judge the sightless method in described appointment interface as:
First specify interface to carry out onResume () method, then monitor and specify interface to carry out OnResume () and OnStop () method; When specifying interface to carry out onStop () method, interface when whether judgement now specifies interface to equal to specify interface to carry out onResume (), if so, represents to specify interface in backstage.
CN201410326440.6A 2014-07-10 2014-07-10 Automatic data refreshing method and system when interface is switched to background for running Pending CN104123181A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410326440.6A CN104123181A (en) 2014-07-10 2014-07-10 Automatic data refreshing method and system when interface is switched to background for running

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410326440.6A CN104123181A (en) 2014-07-10 2014-07-10 Automatic data refreshing method and system when interface is switched to background for running

Publications (1)

Publication Number Publication Date
CN104123181A true CN104123181A (en) 2014-10-29

Family

ID=51768603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410326440.6A Pending CN104123181A (en) 2014-07-10 2014-07-10 Automatic data refreshing method and system when interface is switched to background for running

Country Status (1)

Country Link
CN (1) CN104123181A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893088A (en) * 2016-03-30 2016-08-24 广东欧珀移动通信有限公司 Application information updating method and user device
WO2017181506A1 (en) * 2016-04-20 2017-10-26 深圳Tcl数字技术有限公司 Display terminal information source switching method and device
CN109885798A (en) * 2019-02-18 2019-06-14 迅雷计算机(深圳)有限公司 A kind of page furbishing method of Android application
CN110502324A (en) * 2019-07-31 2019-11-26 湖南微算互联信息技术有限公司 The processing method, system and storage medium for restarting data of cloud mobile phone games

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103793257A (en) * 2014-03-07 2014-05-14 中南大学 Streaming Android program executing method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103793257A (en) * 2014-03-07 2014-05-14 中南大学 Streaming Android program executing method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
VALL_LWJ,贵子逍: "Android UI更新中 ImageView使用setBackgroundResource多次更新图片失效", 《百度知道》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893088A (en) * 2016-03-30 2016-08-24 广东欧珀移动通信有限公司 Application information updating method and user device
CN105893088B (en) * 2016-03-30 2020-07-03 Oppo广东移动通信有限公司 Application information updating method and user equipment
WO2017181506A1 (en) * 2016-04-20 2017-10-26 深圳Tcl数字技术有限公司 Display terminal information source switching method and device
CN109885798A (en) * 2019-02-18 2019-06-14 迅雷计算机(深圳)有限公司 A kind of page furbishing method of Android application
CN110502324A (en) * 2019-07-31 2019-11-26 湖南微算互联信息技术有限公司 The processing method, system and storage medium for restarting data of cloud mobile phone games
CN110502324B (en) * 2019-07-31 2022-03-22 湖南微算互联信息技术有限公司 Processing method, system and storage medium for restart data of cloud mobile phone game

Similar Documents

Publication Publication Date Title
KR102334950B1 (en) Method and apparatus for managing background application
CN109408223B (en) Resource allocation method, device, terminal and storage medium
US8543164B2 (en) Sleep method, wake method and mobile terminal device
CN109343902B (en) Audio processing assembly operation method and device, terminal and storage medium
CN107851050B (en) Device with watchdog timer and method for operating watchdog timer
CN104123181A (en) Automatic data refreshing method and system when interface is switched to background for running
CN109064538B (en) View rendering method and device, storage medium and intelligent terminal
CN108040292B (en) Television standby starting method, television and computer readable storage medium
CN108513145B (en) Control method and device for live broadcast with wheat
CN104239131A (en) Method and device for shutting application program
US8909911B2 (en) Power-on/off management system and method of communication device
CN112131015B (en) Information processing method and device, cloud server and storage medium
WO2015188761A1 (en) Traffic acquiring method and apparatus based on operating system
CN102609302A (en) Multimedia application concurrent-management method and multimedia application concurrent-management device
CN111083564B (en) Intelligent television upgrading method, intelligent terminal, intelligent peripheral and intelligent television
CN111488207B (en) Application process keep-alive method and device, network equipment and storage medium
CN113138559A (en) Device interaction method and device, electronic device and storage medium
CN103853632A (en) Snapshot method, service node, master control node and system
CN111176699A (en) Control method, control device, and computer storage medium
US9176836B2 (en) Automatic diagnosis system and method thereof
US20190306571A1 (en) Coordinated background tv recognition
CN114337896B (en) Equipment state processing method and device, storage medium and electronic device
CN105573833A (en) Method and apparatus for processing client application and mobile terminal
CN111930481B (en) Android system-based process priority improving method and device
CN112416641A (en) Controlled end node restart detection method in master-slave architecture and master control end node

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: The central Shenzhen city of Guangdong Province, 518057 Keyuan Road, Nanshan District science and Technology Park No. 15 Science Park Sinovac A Building 1 unit 403, No. 405 unit

Applicant after: Shenzhen Yunzhou Multimedia Technology Co., Ltd.

Address before: Unit B4 9 building 518057 Guangdong city of Shenzhen province Nanshan District high in the four EVOC Technology Building No. 31

Applicant before: Shenzhen Yunzhou Multimedia Technology Co., Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20141029