WO2017157186A1 - 基于Android的弹框提示方法及装置 - Google Patents

基于Android的弹框提示方法及装置 Download PDF

Info

Publication number
WO2017157186A1
WO2017157186A1 PCT/CN2017/075520 CN2017075520W WO2017157186A1 WO 2017157186 A1 WO2017157186 A1 WO 2017157186A1 CN 2017075520 W CN2017075520 W CN 2017075520W WO 2017157186 A1 WO2017157186 A1 WO 2017157186A1
Authority
WO
WIPO (PCT)
Prior art keywords
activity
component
onpause
onstop
frame component
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.)
Ceased
Application number
PCT/CN2017/075520
Other languages
English (en)
French (fr)
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to MYPI2018703247A priority Critical patent/MY192615A/en
Priority to EP17765728.5A priority patent/EP3432140B1/en
Priority to KR1020187028698A priority patent/KR102194055B1/ko
Priority to SG11201807866TA priority patent/SG11201807866TA/en
Priority to JP2018549247A priority patent/JP6736130B2/ja
Publication of WO2017157186A1 publication Critical patent/WO2017157186A1/zh
Priority to PH12018501968A priority patent/PH12018501968A1/en
Priority to US16/131,701 priority patent/US10678564B2/en
Anticipated expiration legal-status Critical
Priority to US16/820,543 priority patent/US10853102B2/en
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present application relates to the field of communications, and in particular, to an Android-based bullet box prompting method and apparatus.
  • the user can be prompted by the system to output a bullet box filled with the prompt copy to the user.
  • the event can be a single sign-on event.
  • the so-called single sign-on usually refers to only allowing users to log in to their account on a device. Once the user logs in with the same login account on other devices, the user needs to be kicked out of the current device.
  • the system detects a single sign-on event the user can output a bulletin box to prompt the user that the current login account has been logged in on another device.
  • the prompt copy in the bullet box may include the reason why the user is kicked out of the login.
  • the output bullet box may be covered by other bullet boxes or other pages, thereby affecting the user's use of the APP or basic functions of the system terminal.
  • the present application proposes an Android-based bullet box prompting method, the method comprising:
  • the activity bullet box component output prompt box is started; wherein the startup mode of the activity bullet box component is pre-configured into a single task mode;
  • the Activity frame component When the Activity frame component is overwritten by other Activity components, the Activity frame component is restarted to trigger the Activity frame component to be moved to the top of the Activity stack so that the prompt box is displayed in the foreground of the system.
  • the determining whether the Activity frame component is covered by other Activity components includes:
  • the bullet box assembly includes:
  • the restarting the activity cartridge component based on the onPause method or the onStop method includes:
  • the Activity cartridge component is restarted based on the onPause method or the onStop method.
  • the method further includes:
  • the present application also provides an Android-based bullet box prompting device, the device comprising:
  • the startup module is configured to start an activity bulletin component output prompt box when the trigger event of the bullet box prompt is detected; wherein the startup mode of the activity bullet frame component is pre-configured into a single task mode;
  • a judging module configured to determine whether the activity bullet box component is covered by another Activity component
  • the restart module is configured to restart the activity frame component when the activity frame component is overwritten by other Activity components, to trigger the activity frame component to be moved to the top of the Activity stack, so that the prompt box is displayed in the foreground of the system.
  • the determining module is specifically configured to:
  • the restart module is specifically configured to:
  • the restart module is further configured to:
  • the Activity cartridge component is restarted based on the onPause method or the onStop method.
  • the device further includes:
  • a shutdown module is configured to perform a normal shutdown for the Activity cartridge component when the inPause method or the onStop method is invoked by a shutdown event for the Activity cartridge component.
  • the activity bullet box component output prompt box is started; wherein the startup mode of the activity bullet box component is pre-configured into a single task mode; determining whether the activity bullet box component is It is overwritten by other Activity components; when the Activity frame component is overwritten by other Activity components, the Activity frame component is restarted to trigger the Activity frame component to be moved to the top of the Activity stack so that the prompt box is displayed in the foreground of the system. After the activity frame is started to output the prompt box to the user, it can be ensured that the prompt box is not overwritten and always displayed in the foreground of the system.
  • FIG. 1 is a flowchart of a method for prompting a bullet box based on Android according to an embodiment of the present application
  • FIG. 2 is a logic block diagram of an Android-based bullet box prompting device according to an embodiment of the present application
  • FIG. 3 is a hardware structural diagram of a terminal that carries the Android-based bullet box prompting apparatus according to an embodiment of the present application.
  • the Android system when the Android system outputs a bullet box to a user, it can usually be implemented as follows:
  • the Android system can utilize the Window component in the Android system to make a bullet box.
  • the Android system can utilize the Activity component to make a bullet box.
  • the Activity component is a component responsible for interacting with the user.
  • the component can provide an interactive interface and display some interactive controls (such as buttons, popups, etc.) on the interactive interface, and the user can operate the interactive controls.
  • the terminal interacts with the terminal, and the terminal can monitor the event of the user for the interaction control in the background to complete the task corresponding to the interaction.
  • the terminal can move the frame through the Activity component, and can implement any Activity component in the system as the main body of the bullet box, and play the bullet box in any page.
  • the Activity component is usually managed in the form of an Activity stack, once the Activity component is overwritten by other Activity components in the Activity stack, the other Activity component occupies the top of the Activity stack, and the Activity component is no longer in the Activity stack.
  • the bullet box output by the Activity component will be covered by other bullet boxes or interfaces, so it cannot be displayed in the foreground of the system, which affects the use of the system's APP or basic functions.
  • the Android system can perform a bullet box on a fixed page.
  • the bullet box on a fixed page cannot achieve the purpose of realizing the bullet box on any interface, so it is not flexible enough and the interactive experience is not good.
  • the bullet box on the login page is used as an example.
  • the output of the bullet box is displayed on the login page. After the system outputs the bullet box to the user, if the system displays other pages in the foreground, only the user actively switches the page.
  • the bulletin box outputted by the system can be viewed on the login page, and the bullet box outputted by the system cannot be notified to the user in time.
  • the present application proposes an Android-based bullet box prompting method, which starts the activity bullet box component output prompt box when the trigger event of the bullet box prompt is monitored; wherein the startup mode of the Activity bullet box component is pre-predicted Configured as a single task mode; determine whether the Activity frame component is overwritten by other Activity components; when the Activity frame component is overwritten by other Activity components, restart the Activity frame component to trigger the Activity frame component to be moved to The top of the Activity stack causes the prompt box to be displayed in the foreground of the system; since the Activity frame component is in the single task mode in this application, when the Activity frame component is restarted, it can be immediately moved to the top of the Activity stack, thereby After the activity cartridge component is started to output a prompt box to the user, it can be ensured that the prompt box is not overwritten and always displayed in the foreground of the system.
  • the present application since the present application is no longer based on the Window component of the Android system, the user does not support the setting of the bullet box. Therefore, it is possible to prevent the user from being able to perform the bullet box because the user manually disables the bullet box in the system. problem.
  • the Activity component is the main body, and it is very flexible in any frame.
  • FIG. 1 is a schematic diagram of an Android-based bullet box prompting method, which is applied to a terminal. The method performs the following steps:
  • Step 101 When the trigger event of the bullet box prompt is detected, the activity bullet box component output prompt box is started; wherein the startup mode of the activity bullet box component is pre-configured into a single task mode;
  • the terminal may include a smart terminal equipped with an Android system; for example, a mobile terminal such as a smart phone or a tablet computer.
  • the triggering event of the above-mentioned bullet box prompt may include an event that the terminal system monitors that needs to output a bullet box prompt to the user.
  • the trigger events of the above-mentioned bullet box prompts may include different types of events, respectively, in different application scenarios.
  • the trigger event of the above-mentioned bullet box prompt may include a single sign-on event.
  • the current terminal can log out of the login state, and output a prompt box to the user to prompt the reason for exiting the login state.
  • the trigger event of the bullet box may include a call incoming event.
  • the user may output a prompt box to prompt the user to receive the incoming call, and the user may perform corresponding operations on the prompt box (such as sliding up or sliding down) to answer the call or hang up. Call.
  • the terminal when the terminal performs a bullet box on the user, the terminal can still be implemented by using a preset Activity frame component. After the terminal listens to the trigger event of the bullet box prompt, the activity bullet box component can be started, an Activity instance for outputting the prompt box is created, and then the prompt text is filled into the prompt box to output to the user based on the instance.
  • the startup mode (launchMode) of the Activity component usually includes four modes: standard mode, singleTop mode, singleTask mode (ie single task mode) and singleInstance mode.
  • the Activity frame component when the startup mode of the Activity component is singleTask mode, the Activity frame component will only allow a unique Activity instance to run.
  • the system will determine whether the Activity instance corresponding to the Activity frame component already exists in the Activity stack, because the Activity corresponding to the Activity frame component already exists in the current Activity stack. Instance, therefore, in the singleTask mode, the system will not create a new Activity instance, the other Activity component that wants to override the Activity frame component will be popped up in the Activity stack, and the Activity frame component corresponding to the existing Activity instance will be re-created. Moved to the Activity stack top. In this case, the prompt box output based on the Activity instance will be displayed again in the foreground of the system without being overwritten.
  • the startup mode of the Activity frame component can be set to the singleTask mode in the initial state.
  • Step 102 Determine whether the Activity frame component is covered by another Activity component.
  • the life cycle of the Activity component usually includes a running state (running state), a Pause state (pause state), a Stop state (stop state), and a Destroy state (off).
  • the running state refers to the state in which the Activity component is visible and can interact with the user.
  • the initial state will be in the running state, which will be placed at the top of the Activity stack and displayed in the system foreground (the front end of the screen).
  • the Pause state means that the Activity component is overwritten by other non-full-screen or semi-transparent Activity components, is no longer at the top of the Activity stack, but is still visible and can interact with the user.
  • the Stop state means that the Activity component is completely covered by other Activity components, no longer at the top of the Activity stack, and the interaction interface of the Activity component is completely hidden.
  • the Destroy state refers only to the state in which the Activity component is closed for destruction.
  • the above four running states can be converted by the user's operation on the Activity component.
  • the Android system when the Activity component is started, if the user starts a new Activity component through the operation, the new Activity component will be moved to the top of the Activity stack, and the original Activity component is overwritten, and the system will call The onPause method converts the original Activity component to the Pause state.
  • the system will call the onStop method to convert the original Activity component to the Stop state.
  • the system will perform the shutdown of the Activity component by calling the onDestroy method to convert the Activity component to the Destroy state when the system memory is insufficient.
  • the system when the system determines whether the Activity frame component is covered by other Activity components, the system can be implemented by determining whether the onPause or onStop method of the Activity frame component is called.
  • Step 103 When the Activity frame component is overwritten by another Activity component, restart the Activity.
  • the bullet box component is configured to trigger the activity cartridge component to be moved to the top of the Activity stack such that the prompt box is displayed in the foreground of the system.
  • the Activity frame component when the system determines that the Activity frame component is overwritten by another Activity component, the Activity frame component can be restarted. Since the Activity frame component has been pre-configured to the singleTask mode, when the Activity frame component is restarted, the system will pop the other Activity component that wants to cover the Activity frame component to pop up the Activity stack.
  • the Activity frame component will be moved back to the top of the Activity stack. In this case, the prompt box output based on the only Activity instance of the Activity frame component will be displayed again in the system foreground without being overwritten.
  • the system can confirm that the Activity cartridge component is overwritten by other Activity components.
  • the restart logic for the Activity frame component can be preloaded in the onPause method; for example, the developer can edit the execution code for performing a restart on the Activity frame component in the onPause() method.
  • the Activity cartridge component can be restarted.
  • the system can confirm that the Activity cartridge component is overwritten by other Activity components.
  • the onStop method can also preload the restart logic for the Activity cartridge component.
  • the system when the system calls the onPause method and the onStop method, it usually calls the onPause method and then calls the onStop method (the calling sequence is the basic processing mechanism of the Android system); however, in some application scenarios, for example, Concurrent frame scenario (that is, when the activity frame component output prompt box, there are other Activity components covering the prompt box output by the Activity frame component), the system may generate the onPause method and the onStop method call sequence. The exception occurs when the onPas method is called without the onPause method, and the onStop method is called directly.
  • the system can further determine the Activity when it is determined that the onStop method of the Activity frame component is called. Whether the onPause method of the frame component has been called, if the onPause method of the Activity frame component has been called, indicating that the Activity frame component has been processed by executing the restart logic loaded in the onPause method, and the system can no longer be processed. Repeat the execution of the restart logic loaded in the onStop method to repeat the processing of the Activity frame component.
  • the system may have a call exception, and the system can normally run the restart logic loaded in the onStop method to restart the Activity frame component.
  • the system may add a mark in the class file of the Activity bullet box component, and then check whether the corresponding mark exists in the class file. to realise.
  • a tag may be added to the class file of the Activity frame component, and the tag is used to indicate the activity frame.
  • the component has been processed based on the restart logic loaded in the onPause method.
  • the system may further check whether the above-mentioned flag exists in the class file of the Activity frame component to confirm whether the onPause method of the Activity frame component has been called. If the above mark exists in the class file, it indicates that the Activity frame component has been processed based on the restart logic loaded in the onPause method, and no further processing is required.
  • the system determines whether the Activity frame component is overwritten by determining whether the OnPause or onStop method of the Activity frame component is called, and when it is determined that the Activity frame component is covered by other Activity components.
  • the activity frame component is restarted by executing the restart logic loaded by the onPause or onStop method, so that the Activity frame component can be relocated to the top of the Activity stack and the output prompt box is redisplayed when pre-configured as singleTask mode. The detailed process of not being overwritten in the foreground of the system.
  • the user in addition to calling the onPause method or the onStop method when the Activity frame component is overwritten by other Activity components, the user usually performs a normal shutdown event to close the Activity frame component.
  • the system also calls the onPause method or the onStop method.
  • the Activity component when the Activity component is in the running state, if the system listens to the user's shutdown event for the Activity component, the system will sequentially call the onPause method and the onStop method to replace the Activity component with the Pause state and the Stop state, and then automatically. Call the onDestroy method to convert the Activity component to the Destroy state to close the Activity component.
  • the closing event may include an event corresponding to a closing operation performed by the user for the Activity frame component; for example, taking a touch screen smart phone equipped with an Android system as an example, the closing event may include a user returning a button on the mobile phone.
  • Click event that is, the user can close the Activity frame component by clicking the back button on the phone.
  • the onPause method and the onStop method sequentially load the Activity component into the Pause state and the Stop state, and then automatically call the onDestroy method to perform shutdown on the Activity component.
  • the system may restart the Activity frame component before restarting the logic based on the onPause method or the onStop method. Further determining whether the call to the onPause method or the onStop method is triggered by a user closing event for the Activity frame component.
  • the system may allow the Activity frame component to be normally closed for the normal closing process of the Activity frame component. And in response to the normal closing process of the Activity frame component, automatically call the onDestroy method of the Activity frame component to close the activity frame component.
  • the system can normally execute the onPause method or the restart logic loaded in the onStop method to restart the activity.
  • the frame component moves the Activity frame component to the top of the Activity stack.
  • the system determines whether the above call of the onPause method or the onStop method is triggered by the user's closing event for the Activity frame component, and can still add a tag in the class file of the Activity frame component. And then by checking if the corresponding tag exists in the class file.
  • a tag may be added to the class file of the Activity frame component, the tag is used to indicate this
  • the call to the onPause method and the onStop method is triggered by the user's shutdown event for the Activity frame component.
  • the system determines that the onPause method or the onStop method is called, it can further check whether the above-mentioned flag exists in the class file of the Activity frame component. If the above mark exists in the class file, it indicates that the call of the onPause method and the onStop method is triggered by the user for the shutdown event of the Activity frame component. The system can respond in accordance with the normal shutdown process for the Activity cartridge component.
  • the system may be restarted because the system restarts the activity by executing the onPause method of the Activity frame component or the restart logic loaded in the onStop method.
  • the problem of misoperation caused by the bullet box component is not limited to:
  • the scenario of the application shown in this example may include an application scenario of single sign-on, and an application scenario in which the call is answered.
  • the trigger event of the bullet box prompt may include a single sign-on event.
  • the user can log in to the terminal by using the login account, and the login server corresponding to the terminal can verify the login account. After the login server verifies the login account, the user successfully logs in. terminal.
  • the login server sends a notification message to the current login terminal, triggering the current login terminal to log out.
  • the current login terminal can be considered to have listened to the single sign-on event.
  • the login state can be exited, and a single sign-on prompt box is output to the user, and the prompt box can be filled in the prompt box.
  • a prompt for prompting the reason for this logout status is provided.
  • the operation state of the activity bullet box component may be set to the singleTask mode by default.
  • the system will call the onPause method or the onStop method, in which the restart logic is preloaded in the onPause method or the onStop method, and the system restarts the logic by executing the onPause method or the onStop method.
  • the Activity cartridge component can be restarted.
  • the Activity frame component Since the Activity frame component is preconfigured to the singleTask mode, when the Activity frame component is restarted, the system will pop up the Activity component of other Activity components that want to overwrite the Activity frame component, and the Activity frame component will be Moved back to the top of the Activity stack. In this case, the above single sign-on prompt box will be displayed again in the foreground of the system, without being overwritten by other prompt boxes or pages, and because other Activity components that want to override the Activity frame component are directly popped up in the Activity stack, The interactive interface corresponding to the other Activity components will not be displayed, and the user cannot perceive the change of the page.
  • the trigger event of the above-mentioned frame prompt may include a call incoming event.
  • the user when the system of the terminal monitors the incoming call, the user may output an incoming call prompt box to prompt the user to receive the incoming call, and the prompt box may be filled with the prompt copy for prompting the originating call.
  • the user can perform corresponding operations on the prompt box, such as sliding up or sliding down to answer the call or hang up the call.
  • the operation state of the activity bullet box component may be set to the singleTask mode by default.
  • the system will call the onPause method or the onStop method, in which the restart logic is preloaded in the onPause method or the onStop method, and the system restarts the logic by executing the onPause method or the onStop method.
  • the Activity cartridge component can be restarted.
  • the Activity frame component Since the Activity frame component is preconfigured to the singleTask mode, when the Activity frame component is restarted, the system will pop up the Activity component of other Activity components that want to overwrite the Activity frame component, and the Activity frame component will be Moved back to the top of the Activity stack. In this case, the above incoming call prompt box will be displayed again in the foreground of the system without being overwritten by other prompt boxes or pages, and since the other Activity components that want to override the Activity bullet box component are directly popped up in the Activity stack, the other The interactive interface corresponding to the Activity component will not be displayed, and the user cannot perceive the page change.
  • the technical solutions in the foregoing embodiments may be applied to other similar scenarios, that is, in practical applications, the application scenarios applicable to the technical solutions in the foregoing embodiments are not limited to the above.
  • it may also include all application scenarios that need to be directed to the user to output a bullet box prompt, and the output prompt box is covered by other prompt boxes or pages, which may affect the use of the APP or basic functions in the system. This application is not listed one by one.
  • the activity bullet box component output prompt box is started; wherein the startup mode of the activity bullet box component is pre-configured into a single task mode; determining the activity Whether the bullet frame component is covered by other Activity components; when the Activity frame component is overwritten by other Activity components, restarting the Activity frame component to trigger the activity frame component to be moved to the top of the Activity stack so that the prompt box is at The system foreground is displayed; since the Activity frame component is in the single task mode in this application, when the Activity frame component is restarted, it can be immediately moved to the top of the Activity stack, thereby outputting the Activity frame component to the user. After the prompt box, you can ensure that the prompt box is not overwritten and always displayed in the foreground of the system.
  • the present application since the present application is no longer based on the Window component of the Android system, the user does not support the setting of the bullet box. Therefore, it is possible to prevent the user from being able to perform the bullet box because the user manually disables the bullet box in the system. problem.
  • the present application performs a bullet box through the Activity bullet box component, it is possible to implement any of the Activity components in the system as a main body, and to perform a bullet box in any page, thereby having high flexibility.
  • the present application also provides an embodiment of the device.
  • the present application provides an Android-based bullet box prompting device 20, which is applied to a terminal.
  • the hardware architecture involved in the terminal that carries the Android-based bullet box prompting device 20 is included in the hardware architecture.
  • the CPU usually includes a CPU, a memory, a non-volatile memory, a network interface, and an internal bus.
  • the Android-based bullet box prompting device 20 can be generally understood as a computer program loaded in a memory, through a CPU.
  • a logical device combined with hardware and software formed after the operation, the device 20 comprising:
  • the startup module 201 is configured to start an activity bulletin component output prompt box when the triggering event of the bullet box prompt is detected; wherein the startup mode of the activity bullet frame component is pre-configured into a single task mode;
  • the determining module 202 is configured to determine whether the Activity cartridge component is covered by another Activity component
  • the restarting module 203 is configured to restart the Activity cartridge component when the Activity cartridge component is overwritten by other Activity components, to trigger the Activity cartridge component to be moved to the top of the Activity stack, so that the prompt box is displayed in the foreground of the system.
  • the determining module 202 is specifically configured to:
  • the restart module 203 is specifically configured to:
  • the restart module 203 is further configured to:
  • the Activity cartridge component is restarted based on the onPause method or the onStop method.
  • the device 20 further includes:
  • the closing module 204 is configured to perform a normal shutdown for the Activity cartridge component when the inPause method or the inStop method is triggered by a shutdown event for the Activity cartridge component.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)
  • Telephone Function (AREA)
  • Stored Programmes (AREA)

Abstract

一种基于Android的弹框提示方法及装置,其中方法包括:在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式(101);判断该Activity弹框组件是否被其它Activity组件覆盖(102);当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示(103)。通过该方法,可以在启动Activity弹框组件向用户输出提示框后,确保该提示框不被覆盖,始终在系统前台显示。

Description

基于Android的弹框提示方法及装置
本申请要求2016年03月16日递交的申请号为201610150785.X、发明名称为“基于Android的弹框提示方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信领域,尤其涉及一种基于Android的弹框提示方法及装置。
背景技术
在Android系统中,对于一些需要向用户输出弹框的事件,通过可以由系统向用户输出填充了提示文案的弹框来提示用户。例如,该事件可以是单点登录事件。所谓单点登陆,通常是指只允许用户在一台设备上登陆其账号,一旦用户在其它设备上使用相同的登录账号登陆,需要把用户从当前的设备上踢出登陆态。当系统检测到了单点登录事件时,可以向用户输出弹框提示用户当前登录账号已在其它设备上登录,此时该弹框中的提示文案可以包括用户被踢出登录的原因。然而,在相关技术中,Android系统在向用户输出弹框时,输出的弹框可能会被其它弹框或者其它页面所覆盖,从而影响用户对系统终端的APP或者基本功能的使用。
发明内容
本申请提出一种基于Android的弹框提示方法,该方法包括:
在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;
判断该Activity弹框组件是否被其它Activity组件覆盖;
当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示。
可选的,所述判断该Activity弹框组件是否被其它Activity组件覆盖包括:
判断所述Activity弹框组件的onPause或者onStop方法是否被调用;
当所述Activity弹框组件的onPause或者onStop方法被调用时,确定该Activity弹框组件被其它Activity组件覆盖。
可选的,所述当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity 弹框组件包括:
当所述Activity弹框组件的onPause方法被调用,基于所述onPause方法重新启动该Activity弹框组件;
当所述Activity弹框组件的onStop方法被调用时,判断所述Activity弹框组件的onPause方法是否已被调用,如果所述onPause方法未被调用,则基于所述onStop方法重新启动该Activity弹框组件。
可选的,所述基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件包括:
判断所述onPause方法或者所述onStop方法的调用是否是由针对所述Activity弹框组件的关闭事件所触发;
如果所述onPause方法或者所述onStop方法的调用不是由针对所述Activity弹框组件的关闭事件所触发,则基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件。
可选的,所述方法还包括:
如果所述onPause方法或者所述onStop方法的调用是由针对所述Activity弹框组件的关闭事件所触发,则针对所述Activity弹框组件执行正常关闭。
本申请还提出一种基于Android的弹框提示装置,该装置包括:
启动模块,用于在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;
判断模块,用于判断该Activity弹框组件是否被其它Activity组件覆盖;
重启模块,用于在该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示。
可选的,所述判断模块具体用于:
判断所述Activity弹框组件的onPause或者onStop方法是否被调用;
当所述Activity弹框组件的onPause或者onStop方法被调用时,确定该Activity弹框组件被其它Activity组件覆盖。
可选的,所述重启模块具体用于:
当所述Activity弹框组件的onPause方法被调用,基于所述onPause方法重新启动该Activity弹框组件;
当所述Activity弹框组件的onStop方法被调用时,判断所述Activity弹框组件的onPause方法是否已被调用,如果所述onPause方法未被调用,则基于所述onStop方法重新启动该Activity弹框组件。
可选的,所述重启模块进一步用于:
判断所述onPause方法或者所述onStop方法的调用是否是由针对所述Activity弹框组件的关闭事件所触发;
如果所述onPause方法或者所述onStop方法的调用不是由针对所述Activity弹框组件的关闭事件所触发,则基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件。
可选的,所述装置还包括:
关闭模块,用于在所述onPause方法或者所述onStop方法的调用是由针对所述Activity弹框组件的关闭事件所触发时,针对所述Activity弹框组件执行正常关闭。
本申请中,通过在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;判断该Activity弹框组件是否被其它Activity组件覆盖;当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示,实现了当启动Activity弹框组件向用户输出了提示框后,可以确保该提示框不被覆盖,始终在系统前台显示。
附图说明
图1是本申请一实施例提供的一种基于Android的弹框提示方法的流程图;
图2是本申请一实施例提供的一种基于Android的弹框提示装置的逻辑框图;
图3是本申请一实施例提供的承载所述一种基于Android的弹框提示装置的终端的硬件结构图。
具体实施方式
在相关技术中,Android系统在向用户输出弹框时,通常可以通过如下方式实现:
在示出的一种实现方式中,Android系统可以利用Android系统中的Window组件来进行弹框。
通过Window组件来弹框,可以实现在任意页面弹框,且不被其他页面覆盖,然而 通过Window组件来弹框,通常支持用户对弹框进行设置,因此当用户通过手动设置在系统中将弹框禁掉,则会导致系统无法进行弹框。
在示出的另一种实现方式中,Android系统可以利用Activity组件来进行弹框。
在Android系统中,Activity组件是一个负责与用户进行交互的组件,该组件可以提供一个交互界面,并在交互界面上显示一些交互控件(比如按钮、弹窗等),用户可以通过操作这些交互控件与终端进行交互,终端在后台可以监听用户针对这些交互控件的事件,来完成与本次交互对应的任务。终端通过Activity组件来弹框,可以实现将系统中任意的Activity组件作为弹框的主体,在任意页面中来进行弹框。然而,由于Activity组件通常是以Activity堆栈的形态进行管理的,一旦该Activity组件在Activity堆栈中被其它Activity组件所覆盖,即该其它Activity组件占据Activity堆栈顶部,而该Activity组件不再处于Activity堆栈的顶部时,该Activity组件输出的弹框将会被其它弹框或者界面覆盖,因而无法在系统前台进行显示,对系统的APP或者基本功能的使用造成影响。
在示出的另一种实现方式中,Android系统可以在一个固定的页面进行弹框。
然而在一个固定的页面进行弹框,无法实现实现在任意界面进行弹框的目的,因此不够灵活,而且交互体验不好。例如,以在登录页面进行弹框为例,输出的弹框智能在登录页面进行显示,系统向用户输出弹框后,如果系统前台显示的为其它页面,那么只有用户在主动进行页面切换,回到登录页面才能够查看到系统输出的弹框,从而会导致系统输出的弹框无法及时的通知到用户。
有鉴于此,本申请提出一种基于Android的弹框提示方法,通过在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;判断该Activity弹框组件是否被其它Activity组件覆盖;当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示;由于在本申请中,Activity弹框组件为单任务模式,因此当该Activity弹框组件被重新启动后,可以立即被移至Activity堆栈顶部,从而在启动Activity弹框组件向用户输出了提示框后,可以确保该提示框不被覆盖,始终在系统前台显示。
同时,由于本申请不再基于Android系统中的Window组件进行弹框,不再支持用户对弹框进行设置,因此可以避免由于用户通过手动设置在系统中将弹框禁掉导致无法进行弹框的问题。
另外,由于本申请通过Activity弹框组件进行弹框,因此可以实现将系统中任意的 Activity组件作为主体,在任意页面中来进行弹框,从而具有很高的灵活性。
下面通过具体实施例并结合具体的应用场景对本申请进行描述。
请参考图1,图1是本申请一实施例提供的一种基于Android的弹框提示方法,应用于终端,所述方法执行以下步骤:
步骤101,在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;
在本例中,上述终端可以包括搭载Android系统的智能终端;例如,智能手机、平板电脑等移动终端等。
上述弹框提示的触发事件可以包括终端系统监听到的需要面向用户输出弹框提示的事件。其中,在不同的应用场景中,上述弹框提示的触发事件可以分别包括不同类型的事件。
例如,在单点登录的应用场景中,上述弹框提示的触发事件可以包括单点登录事件。在该应用场景中,当用户使用相同登录账号在其它终端上登录时,当前终端可以退出登录状态,并面向用户输出一个提示框提示本次退出登录状态的原因。
又如,在呼叫来电接听的应用场景中,上述弹框提示的触发事件可以包括呼叫来电事件。当终端的系统监听到呼叫来电时,可以向用户输出一个提示框提示用户接收到了来电,用户此时可以针对该提示框进行相应的操作(比如向上滑动或者向下滑动)来接听来电或者挂断来电。
在本例中,终端在向用户进行弹框时,仍然可以利用预设的Activity弹框组件来实现。当终端监听到弹框提示的触发事件后,可以启动Activity弹框组件,创建一个用于输出提示框的Activity实例,然后基于该实例将提示文案填充到提示框中向用户输出。
在Android系统中,Activity组件的启动模式(launchMode)通常包standard模式,singleTop模式,singleTask模式(即单任务模式)以及singleInstance模式等四种模式。
其中,当Activity组件的启动模式为singleTask模式时,该Activity弹框组件将只允许唯一的Activity实例运行。
在singleTask模式下,该Activity弹框组件被启动后,系统会判断Activity堆栈中是否已经存在与该Activity弹框组件对应的Activity实例,由于当前Activity堆栈中已经存在与该Activity弹框组件对应的Activity实例,因此在singleTask模式下系统将不会再新建Activity实例,会将想要覆盖该Activity弹框组件的其它Activity组件弹出Activity堆栈,并将已经存在的该Activity示例所对应的Activity弹框组件重新移至Activity堆栈的 顶部。在这种情况下,基于该Activity实例输出的提示框将会重新在系统前台显示而不被覆盖。
基于此,在本例中,为了使Activity弹框组件输出的提示框不被其它提示框或者页面所覆盖,可以在初始状态下,将该Activity弹框组件的启动模式设置为singleTask模式。
步骤102,判断该Activity弹框组件是否被其它Activity组件覆盖;
在Android系统中,Activity组件的生命周期中通常包括running状态(运行状态)、Pause状态(暂停状态)、Stop状态(停止状态)以及Destroy状态(关闭)。
其中,running状态,是指Activity组件处于可见并且可以和用户进行交互的状态。当Activity组件启动后,初始状态会处于running状态,此时会被放入在Activity堆栈的顶部,在系统前台(屏幕最前端)显示。
Pause状态,是指Activity组件被其它的非全屏或者半透明的Activity组件所覆盖,不再处于Activity堆栈顶部,但仍然处于可见并且可以和用户进行交互的状态。
Stop状态,是指Activity组件被其它的Activity组件完全覆盖,不再处于Activity堆栈顶部,该Activity组件的交互界面被完全被隐藏的状态。
Destroy状态,只指Activity组件被关闭销毁的状态。
其中,以上四种运行状态可以通过用户针对该Activity组件的操作来进行转换。
在Android系统中,当Activity组件启动后,如果用户通过操作启动了新的Activity组件,那么该新的Activity组件会被移入Activity堆栈顶部,对原有的该Activity组件进行覆盖,此时系统会调用onPause方法将原有的Activity组件转换为Pause状态。
当该原有的Activity组件被完全覆盖后,此时系统会调用onStop方法将该原有的Activity组件转换为Stop状态。
其中,当该原有的Activity组件处于Pause状态或者Stop状态时,系统会在系统内存不足的时候,通过调用onDestroy方法将该Activity组件转换为Destroy状态对该Activity组件执行关闭。
基于此,在示出的一种实施方式中,系统在判断该Activity弹框组件是否被其它Activity组件覆盖时,可以通过判断该Activity弹框组件的onPause或者onStop方法是否被调用来实现。
当该Activity弹框组件的onPause或者onStop方法被调用时,则可以确定当前该Activity弹框组件被其它Activity组件覆盖,不再处于堆栈顶部。
步骤103,当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity 弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示。
在本例中,当系统判断出该Activity弹框组件被其它Activity组件覆盖时,可以重新启动该Activity弹框组件。由于该Activity弹框组件已经被预配置为singleTask模式,因此当该Activity弹框组件被重新启动后,系统会将想要覆盖该Activity弹框组件的其它Activity组件弹出Activity堆栈,此时
该Activity弹框组件将会被重新移至Activity堆栈顶部,在这种情况下,基于该Activity弹框组件唯一Activity实例输出的提示框将会重新在系统前台显示而不被覆盖。
在示出的一种实施方式中,如果系统判断出该Activity弹框组件的onPause方法被调用,此时系统可以确认该Activity弹框组件被其它Activity组件覆盖。
在这种情况下,可以在onPause方法中预先加载针对Activity弹框组件的重启逻辑;比如,开发人员可以在onPause()方法中编辑用于针对Activity弹框组件执行重启的执行代码。当系统调用该onPause方法后,则可以重新启动该Activity弹框组件。
在示出的另一种实施方式中,如果系统判断出该Activity弹框组件的onStop方法被调用,此时系统可以确认该Activity弹框组件被其它Activity组件覆盖。其中,该onStop方法也可以预先加载针对Activity弹框组件的重启逻辑。
在Android系统中,系统在针对onPause方法和onStop方法进行调用时,通常是先调用onPause方法再调用onStop方法(该调用顺序为Android系统的基本处理机制);然而,在一些应用场景中,比如,并发弹框的场景(即当该Activity弹框组件输出提示框的同时,就有其它Activity组件对该Activity弹框组件输出的提示框进行覆盖),系统可能会产生onPause方法和onStop方法调用顺序上的异常,出现在onPause方法未调用的情况下绕过onPause方法而直接调用onStop方法的情况。
因此,针对这些异常的应用场景,为了避免通过onStop方法中加载的重启逻辑对该Activity弹框组件进行重复处理,系统在判断出该Activity弹框组件的onStop方法被调用时,可以进一步判断该Activity弹框组件的onPause方法是否已经被调用,如果该Activity弹框组件的onPause方法已经被调用,表明该Activity弹框组件已经通过执行onPause方法中加载的重启逻辑进行了处理,此时系统可以不再重复执行该onStop方法中加载的重启逻辑对该Activity弹框组件进行重复处理。
当然,如果该Activity弹框组件的onPause方法未被调用,此时系统可能发生了调用异常,系统可以正常运行onStop方法中加载的重启逻辑,重新启动该Activity弹框组件。
其中,需要指出的是,系统在判断该Activity弹框组件的onPause方法是否已经被调用时,可以通过在该Activity弹框组件的类文件中增加标记,然后通过检查类文件中是否存在对应的标记来实现。
例如,在实现时,当系统调用onPause方法中加载的重启逻辑对该Activity弹框组件处理完成后,可以在该Activity弹框组件的类文件中增加一个标记,该标记用于表示该Activity弹框组件已经基于onPause方法中加载的重启逻辑处理完成。
当系统判断出该Activity弹框组件的onStop方法被调用,可以进一步检查该Activity弹框组件的类文件中是否存在上述标记,来确认该Activity弹框组件的onPause方法是否已经被调用。如果类文件中存在上述标记,表明该Activity弹框组件已经基于onPause方法中加载的重启逻辑处理完成,不再需要重复处理。
可见,通过这种方式,可以在onPause方法和onStop方法的调用顺序异常的应用场景中,避免通过onStop方法中加载的重启逻辑对该Activity弹框组件进行重复处理。
以上实施例中,描述了系统通过判断Activity弹框组件的onPause或者onStop方法是否被调用,来确认Activity弹框组件是否其它Activity被覆盖,并在判断出Activity弹框组件被其它Activity组件覆盖时,通过执行onPause或者onStop方法加载的重启逻辑重新启动该Activity弹框组件,使得该Activity弹框组件在预配置为singleTask模式的情况下,可以被重新移至Activity堆栈顶部,将输出的提示框重新显示在系统前台不被覆盖的详细过程。
然而,在Android系统中,系统除了会在Activity弹框组件被其它Activity组件被其它Activity组件覆盖时,调用onPause方法或者onStop方法以外,当用户通常执行正常的关闭事件,来关闭该Activity弹框组件时,系统也会调用onPause方法或者onStop方法。
例如,当该Activity组件处于running状态时,如果系统监听到了用户针对该Activity组件的关闭事件,系统会按照顺序调用onPause方法和onStop方法将该Activity组件依次装换为Pause状态和Stop状态,然后自动调用onDestroy方法将该Activity组件转换为Destroy状态对该Activity组件执行关闭。
其中,上述关闭事件可以包括与用户针对该Activity弹框组件执行的关闭操作对应的事件;比如,以搭载Android系统的触屏智能手机为例,该关闭事件可以包括用户针对手机上的返回键的点击事件,即用户可以通过点击手机上的返回键,来关闭该Activity弹框组件。当手机系统在后台监听到用户针对返回键的点击事件时,可以按照顺序调用 onPause方法和onStop方法将该Activity组件依次装换为Pause状态和Stop状态,然后自动调用onDestroy方法针对该Activity组件执行关闭。
可见,在用户针对该Activity弹框组件进行正常关闭的应用场景中,由于对onPause方法或onStop方法的调用是由用户的正常关闭操作所触发,而并不是由该Activity弹框组件被其它Activity组件覆盖的事件所触发,因此如果系统仍然通过执行该Activity弹框组件的onPause方法或onStop方法中加载的重启逻辑,重新启动该Activity弹框组件,那么将会导致用户的误操作(即用户想要关闭该Activity弹框组件,但通过上述重启逻辑却重新启动了该Activity弹框组件)。
因此,为了避免误操作,当系统判断出该Activity弹框组件的onPause方法或者onStop方法被调用时,系统在基于该onPause方法或者onStop方法中加载的重启逻辑重新启动该Activity弹框组件之前,可以进一步判断该onPause方法或者onStop方法的调用是否是由用户针对该Activity弹框组件的关闭事件所触发的。
如果该onPause方法或者onStop方法的调用是由用户针对该Activity弹框组件的关闭事件所触发的,此时为针对该Activity弹框组件的正常关闭流程,系统可以允许该Activity弹框组件正常关闭,并按照针对该Activity弹框组件的正常关闭流程进行响应,自动调用Activity弹框组件的onDestroy方法关闭该ctivity弹框组件。
当然,如果该onPause方法或者onStop方法的调用并不是由用户针对该Activity弹框组件的关闭事件所触发的,此时系统可以正常的执行onPause方法或者onStop方法中加载的重启逻辑,重新启动该Activity弹框组件,将该Activity弹框组件移至Activity堆栈的顶部。
其中,需要指出的是,系统在判断上述onPause方法或者onStop方法的调用是否是由用户针对该Activity弹框组件的关闭事件所触发的,仍然可以通过在该Activity弹框组件的类文件中增加标记,然后通过检查类文件中是否存在对应的标记来实现。
例如,在实现时,当系统监听到用户针对该Activity弹框组件的关闭事件,调用onPause方法以及onStop方法后,可以在该Activity弹框组件的类文件中增加一个标记,该标记用于表示本次onPause方法以及onStop方法的调用是由用户针对该Activity弹框组件的关闭事件触发的。
当系统判断出onPause方法或者onStop方法被调用,可以进一步检查该Activity弹框组件的类文件中是否存在上述标记。如果类文件中存在上述标记,则表明本次onPause方法以及onStop方法的调用是由用户针对该该Activity弹框组件的关闭事件触发,此时 系统可以按照针对该Activity弹框组件的正常关闭流程进行响应即可。
可见,通过这种方式,可以在用户针对该Activity弹框组件执行正常关闭的应用场景中,避免由于系统通过执行该Activity弹框组件的onPause方法或onStop方法中加载的重启逻辑,重新启动该Activity弹框组件,而导致的误操作的问题。
以下结合具体的应用场景对以上实施例中的技术方案进行详细描述。
在本例中示出的应用的场景可以包括单点登录的应用场景,以及呼叫来电接听的应用场景。
一方面,在示出的单点登录的应用场景中,上述弹框提示的触发事件可以包括单点登录事件。在该应用场景中,用户可以使用登录账号在终端上登录,与该终端对应的登录服务端可以对该登录账号进行验证,当登录服务端对该登录账号验证通过后,此时用户成功登录该终端。
当用户使用相同登录账号在其它终端上登录时,登录服务端会向当前的登录终端发送一个通知消息,触发当前的登录终端退出登录状态。当前的登录终端在接收到服务端发送的该通知消息后,可以认为监听到了单点登录事件,此时可以退出登录状态,并面向用户输出一个单点登录提示框,在该提示框中可以填充用于提示本次退出登录状态的原因的提示文案。
系统在通过启动Activity弹框组件输出上述单点登录提示框时,为了避免输出的该提示框被其它提示框或者页面覆盖,可以默认将该Activity弹框组件的运行状态设置为singleTask模式。
当该Activity弹框组件被其它Activity组件覆盖时,系统会调用onPause方法或者onStop方法,其中在onPause方法或者onStop方法中预先加载了重启逻辑,系统通过执行该onPause方法或者onStop方法的重启逻辑后,可以重新启动该Activity弹框组件。
由于该Activity弹框组件被预配置为singleTask模式,因此当该Activity弹框组件被重新启动后,系统会将想要覆盖该Activity弹框组件的其它Activity组件弹出Activity堆栈,该Activity弹框组件会被重新移至Activity堆栈顶部。在这种情况下,上述单点登录提示框将会重新在系统前台显示,而不被其它提示框或者页面覆盖,而且由于想要覆盖该Activity弹框组件的其它Activity组件被直接弹出Activity堆栈,该其它Activity组件所对应的交互界面将无法显示出来,对于用户来说无法感知到页面的变化。
可见,在单点登录的应用场景中,通过这种方式,可以避免由于单点登录提示框被覆盖,而造成的提示信息无法及时的提示给用户的问题。
另一方面,在示出的呼叫来电接听的应用场景中,上述弹框提示的触发事件可以包括呼叫来电事件。在该应用场景中,当终端的系统监听到呼叫来电时,可以向用户输出一个来电提示框提示用户接收到了来电,在该提示框中可以填充用于提示本次来电呼叫发起方的提示文案。用户可以针对该提示框进行相应的操作,比如向上滑动或者向下滑动,来接听该来电或者挂断该来电。
在这种场景中,如果系统在接收到呼叫来电时所输出的来电提示框,被其它提示框或者页面所覆盖,那么可能导致用户无法针对来电提示框进行操作,来接听该来电,甚至还可能会导致该来电提示框被覆盖时,终端的按键(比如Home键)失效等兼容性的问题。
系统在通过启动Activity弹框组件输出上述来电提示框时,为了避免输出的该提示框被其它提示框或者页面覆盖,可以默认将该Activity弹框组件的运行状态设置为singleTask模式。
当该Activity弹框组件被其它Activity组件覆盖时,系统会调用onPause方法或者onStop方法,其中在onPause方法或者onStop方法中预先加载了重启逻辑,系统通过执行该onPause方法或者onStop方法的重启逻辑后,可以重新启动该Activity弹框组件。
由于该Activity弹框组件被预配置为singleTask模式,因此当该Activity弹框组件被重新启动后,系统会将想要覆盖该Activity弹框组件的其它Activity组件弹出Activity堆栈,该Activity弹框组件会被重新移至Activity堆栈顶部。在这种情况下,上述来电提示框将会重新在系统前台显示,而不被其它提示框或者页面覆盖,而且由于想要覆盖该Activity弹框组件的其它Activity组件被直接弹出Activity堆栈,该其它Activity组件所对应的交互界面将无法显示出来,对于用户来说无法感知到页面的变化。
可见,在呼叫来电接听的应用场景中,通过这种方式,可以避免由于来电提示框被覆盖,而造成的用户无法接听来电,以及导致的终端按键的兼容性的问题。
当然,除了以上示出的应用场景以外,以上实施例中的技术方案还可以应用在其它的类似场景中,即在实际应用中,以上实施例中的技术方案所适用的应用场景,除了以上示出的应用场景以外,还可以包括所有需要面向用户输出弹框提示,并且输出的提示框被其它提示框或者页面覆盖时,可能会对系统中的APP或者基本功能的使用造成影响的应用场景,本申请不再一一列举。
在以上实施例中,通过在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;判断该Activity 弹框组件是否被其它Activity组件覆盖;当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示;由于在本申请中,Activity弹框组件为单任务模式,因此当该Activity弹框组件被重新启动后,可以立即被移至Activity堆栈顶部,从而在启动Activity弹框组件向用户输出了提示框后,可以确保该提示框不被覆盖,始终在系统前台显示。
同时,由于本申请不再基于Android系统中的Window组件进行弹框,不再支持用户对弹框进行设置,因此可以避免由于用户通过手动设置在系统中将弹框禁掉导致无法进行弹框的问题。
另外,由于本申请通过Activity弹框组件进行弹框,因此可以实现将系统中任意的Activity组件作为主体,在任意页面中来进行弹框,从而具有很高的灵活性。
与上述方法实施例相对应,本申请还提供了装置的实施例。
请参见图2,本申请提出一种基于Android的弹框提示装置20,应用于终端;其中,请参见图3,作为承载所述基于Android的弹框提示装置20的终端所涉及的硬件架构中,通常包括CPU、内存、非易失性存储器、网络接口以及内部总线等;以软件实现为例,所述基于Android的弹框提示装置20通常可以理解为加载在内存中的计算机程序,通过CPU运行之后形成的软硬件相结合的逻辑装置,所述装置20包括:
启动模块201,用于在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;
判断模块202,用于判断该Activity弹框组件是否被其它Activity组件覆盖;
重启模块203,用于在该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示。
在本例中,所述判断模块202具体用于:
判断所述Activity弹框组件的onPause或者onStop方法是否被调用;
当所述Activity弹框组件的onPause或者onStop方法被调用时,确定该Activity弹框组件被其它Activity组件覆盖。
在本例中,所述重启模块203具体用于:
当所述Activity弹框组件的onPause方法被调用,基于所述onPause方法重新启动该Activity弹框组件;
当所述Activity弹框组件的onStop方法被调用时,判断所述Activity弹框组件的onPause方法是否已被调用,如果所述onPause方法未被调用,则基于所述onStop方法重新启动该Activity弹框组件。
在本例中,所述重启模块203进一步用于:
判断所述onPause方法或者所述onStop方法的调用是否是由针对所述Activity弹框组件的关闭事件所触发;
如果所述onPause方法或者所述onStop方法的调用不是由针对所述Activity弹框组件的关闭事件所触发,则基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件。
在本例中,所述装置20还包括:
关闭模块204,用于在所述onPause方法或者所述onStop方法的调用是由针对所述Activity弹框组件的关闭事件所触发时,针对所述Activity弹框组件执行正常关闭。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。

Claims (10)

  1. 一种基于Android的弹框提示方法,其特征在于,该方法包括:
    在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;
    判断该Activity弹框组件是否被其它Activity组件覆盖;
    当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示。
  2. 根据权利要求1所述的方法,其特征在于,所述判断该Activity弹框组件是否被其它Activity组件覆盖包括:
    判断所述Activity弹框组件的onPause或者onStop方法是否被调用;
    当所述Activity弹框组件的onPause或者onStop方法被调用时,确定该Activity弹框组件被其它Activity组件覆盖。
  3. 根据权利要求2所述的方法,其特征在于,所述当该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件包括:
    当所述Activity弹框组件的onPause方法被调用,基于所述onPause方法重新启动该Activity弹框组件;
    当所述Activity弹框组件的onStop方法被调用时,判断所述Activity弹框组件的onPause方法是否已被调用,如果所述onPause方法未被调用,则基于所述onStop方法重新启动该Activity弹框组件。
  4. 根据权利要求3所述的方法,其特征在于,所述基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件包括:
    判断所述onPause方法或者所述onStop方法的调用是否是由针对所述Activity弹框组件的关闭事件所触发;
    如果所述onPause方法或者所述onStop方法的调用不是由针对所述Activity弹框组件的关闭事件所触发,则基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件。
  5. 根据权利要求4所述的方法,所述方法还包括:
    如果所述onPause方法或者所述onStop方法的调用是由针对所述Activity弹框组件的关闭事件所触发,则针对所述Activity弹框组件执行正常关闭。
  6. 一种基于Android的弹框提示装置,其特征在于,该装置包括:
    启动模块,用于在监听到弹框提示的触发事件时,启动Activity弹框组件输出提示框;其中,该Activity弹框组件的启动模式被预配置为单任务模式;
    判断模块,用于判断该Activity弹框组件是否被其它Activity组件覆盖;
    重启模块,用于在该Activity弹框组件被其它Activity组件覆盖时,重新启动该Activity弹框组件,以触发将该Activity弹框组件移至Activity堆栈顶部使得所述提示框在系统前台显示。
  7. 根据权利要求6所述的装置,其特征在于,所述判断模块具体用于:
    判断所述Activity弹框组件的onPause或者onStop方法是否被调用;
    当所述Activity弹框组件的onPause或者onStop方法被调用时,确定该Activity弹框组件被其它Activity组件覆盖。
  8. 根据权利要求7所述的装置,其特征在于,所述重启模块具体用于:
    当所述Activity弹框组件的onPause方法被调用,基于所述onPause方法重新启动该Activity弹框组件;
    当所述Activity弹框组件的onStop方法被调用时,判断所述Activity弹框组件的onPause方法是否已被调用,如果所述onPause方法未被调用,则基于所述onStop方法重新启动该Activity弹框组件。
  9. 根据权利要求8所述的装置,其特征在于,所述重启模块进一步用于:
    判断所述onPause方法或者所述onStop方法的调用是否是由针对所述Activity弹框组件的关闭事件所触发;
    如果所述onPause方法或者所述onStop方法的调用不是由针对所述Activity弹框组件的关闭事件所触发,则基于所述onPause方法或者所述onStop方法重新启动该Activity弹框组件。
  10. 根据权利要求9所述的装置,其特征在于,所述装置还包括:
    关闭模块,用于在所述onPause方法或者所述onStop方法的调用是由针对所述Activity弹框组件的关闭事件所触发时,针对所述Activity弹框组件执行正常关闭。
PCT/CN2017/075520 2016-03-16 2017-03-03 基于Android的弹框提示方法及装置 Ceased WO2017157186A1 (zh)

Priority Applications (8)

Application Number Priority Date Filing Date Title
MYPI2018703247A MY192615A (en) 2016-03-16 2017-03-03 Android-based pop-up prompt method and device
EP17765728.5A EP3432140B1 (en) 2016-03-16 2017-03-03 Android-based pop-up prompt method and device
KR1020187028698A KR102194055B1 (ko) 2016-03-16 2017-03-03 안드로이드 기반의 팝업 프롬프트 방법 및 디바이스
SG11201807866TA SG11201807866TA (en) 2016-03-16 2017-03-03 Android-based pop-up prompt method and device
JP2018549247A JP6736130B2 (ja) 2016-03-16 2017-03-03 アンドロイドベースのポップアッププロンプト方法及びデバイス
PH12018501968A PH12018501968A1 (en) 2016-03-16 2018-09-13 Android-based pop-up prompt method and device
US16/131,701 US10678564B2 (en) 2016-03-16 2018-09-14 Android-based pop-up prompt method and device
US16/820,543 US10853102B2 (en) 2016-03-16 2020-03-16 Android-based pop-up prompt method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610150785.X 2016-03-16
CN201610150785.XA CN107203369A (zh) 2016-03-16 2016-03-16 基于Android的弹框提示方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/131,701 Continuation US10678564B2 (en) 2016-03-16 2018-09-14 Android-based pop-up prompt method and device

Publications (1)

Publication Number Publication Date
WO2017157186A1 true WO2017157186A1 (zh) 2017-09-21

Family

ID=59850086

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/075520 Ceased WO2017157186A1 (zh) 2016-03-16 2017-03-03 基于Android的弹框提示方法及装置

Country Status (10)

Country Link
US (2) US10678564B2 (zh)
EP (1) EP3432140B1 (zh)
JP (1) JP6736130B2 (zh)
KR (1) KR102194055B1 (zh)
CN (1) CN107203369A (zh)
MY (1) MY192615A (zh)
PH (1) PH12018501968A1 (zh)
SG (1) SG11201807866TA (zh)
TW (1) TW201734790A (zh)
WO (1) WO2017157186A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109213582A (zh) * 2018-07-16 2019-01-15 北京奇虎科技有限公司 一种运行服务组件的方法、装置及终端
KR20200106550A (ko) * 2018-01-29 2020-09-14 후아웨이 테크놀러지 컴퍼니 리미티드 인증 창 디스플레이 방법 및 장치
CN113722035A (zh) * 2021-08-31 2021-11-30 平安消费金融有限公司 弹框任务管理及弹框展示方法、装置、设备和存储介质

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107203369A (zh) 2016-03-16 2017-09-26 阿里巴巴集团控股有限公司 基于Android的弹框提示方法及装置
CN108829487B (zh) * 2018-06-28 2022-07-29 北京五八信息技术有限公司 一种弹窗的展示方法、装置、存储介质及终端
CN109543407B (zh) * 2018-10-19 2024-04-05 三六零科技集团有限公司 一种Activity劫持的拦截方法及装置
CN110866247B (zh) * 2018-11-23 2022-03-11 北京安天网络安全技术有限公司 一种安全防御方法、装置、电子设备及存储介质
CN109634702B (zh) * 2018-12-10 2020-04-24 北京字节跳动网络技术有限公司 一种信息提示的方法、装置、电子设备及可读介质
CN112230924A (zh) * 2020-11-09 2021-01-15 平安普惠企业管理有限公司 弹框提示方法、装置、计算机设备及存储介质
TWI765706B (zh) * 2021-05-11 2022-05-21 凌華科技股份有限公司 彈出視窗的非侵入式共享處理方法及系統
KR20230019703A (ko) * 2021-08-02 2023-02-09 삼성전자주식회사 화면 제어 방법 및 장치
JP7440669B2 (ja) 2021-08-02 2024-02-28 サムスン エレクトロニクス カンパニー リミテッド 画面制御方法及び装置
CN115220888A (zh) * 2022-06-17 2022-10-21 上海仪电(集团)有限公司中央研究院 一种支持处理乱序中断任务的弹框控制方法及系统
CN115080889B (zh) * 2022-07-26 2023-01-17 阿里巴巴(中国)有限公司 一种显示模式切换方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102063325A (zh) * 2011-01-06 2011-05-18 哈尔滨工业大学 一种嵌入51系列单片机的多任务实时操作系统的实现方法
CN103559035A (zh) * 2013-10-31 2014-02-05 青岛海信移动通信技术股份有限公司 一种应用于Android平台的处理事件的方法和装置
CN104360794A (zh) * 2014-11-21 2015-02-18 北京奇虎科技有限公司 通过识别全屏模式控制窗口弹出的方法及装置
CN104572110A (zh) * 2015-01-19 2015-04-29 山东大学 一种安卓系统上Toast控件的优化方法
CN104915090A (zh) * 2014-03-13 2015-09-16 宏碁股份有限公司 通知事件呈现方法与电子装置

Family Cites Families (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6801230B2 (en) * 2001-12-18 2004-10-05 Stanley W. Driskell Method to display and manage computer pop-up controls
US8484576B2 (en) * 2003-04-17 2013-07-09 Supersonic Aerospace International, Llc System and method for customizing multiple windows of information on a display
US20060070008A1 (en) * 2004-09-29 2006-03-30 Microsoft Corporation Preserving browser window integrity
US20080295025A1 (en) * 2007-05-24 2008-11-27 Gyure Wesley J System and Method for Implementing Adaptive Window and Dialog Management
US8510743B2 (en) * 2007-10-31 2013-08-13 Google Inc. Terminating computer applications
US8745191B2 (en) * 2009-01-28 2014-06-03 Headwater Partners I Llc System and method for providing user notifications
US9152299B2 (en) * 2009-10-08 2015-10-06 Red Hat, Inc. Activity management tool
US8698845B2 (en) 2010-01-06 2014-04-15 Apple Inc. Device, method, and graphical user interface with interactive popup views
US20120072867A1 (en) * 2010-09-17 2012-03-22 Apple Inc. Presenting pop-up controls in a user interface
CN102156615B (zh) * 2011-04-01 2015-11-25 北京奇虎科技有限公司 一种悬浮窗显示方法及装置
US9037963B1 (en) * 2011-04-22 2015-05-19 Amazon Technologies, Inc. Secure cross-domain web browser communications
CN102521020B (zh) * 2011-10-26 2014-05-21 华为终端有限公司 用于移动终端的应用屏幕截图方法和装置
CN103428523B (zh) * 2012-05-22 2015-07-08 华为技术有限公司 评估视频质量的方法和装置
CN103729176B (zh) * 2012-10-12 2018-01-26 腾讯科技(深圳)有限公司 应用程序整合方法及装置
US20140136279A1 (en) * 2012-11-14 2014-05-15 Purna Chander Ramini OneClue Software System and Method
US10564792B2 (en) * 2012-12-06 2020-02-18 Samsung Electronics Co., Ltd. Display device and method of indicating an active region in a milti-window display
JP5722376B2 (ja) * 2013-03-29 2015-05-20 シャープ株式会社 ユーザ状況確認システム、ユーザ状況確認方法、通信端末装置、ユーザ状況通知方法、及びコンピュータプログラム
JP6058132B2 (ja) * 2013-05-31 2017-01-11 三菱電機株式会社 ポップアップ表示装置
US20150058826A1 (en) * 2013-08-26 2015-02-26 The Trustees Of Columbia University In The City Of New York Systems and methods for efficiently and effectively detecting mobile app bugs
US9984441B2 (en) 2014-06-18 2018-05-29 Lenovo Enterprise Solutions (Singapore) Pte. Ltd. Unobtrusive sizing and placement of pop-ups
CN104123499B (zh) * 2014-07-18 2017-09-01 北京金山安全软件有限公司 一种利用Android设备管理器对抗卸载的软件的识别方法及装置
KR101543236B1 (ko) * 2015-05-13 2015-08-11 주식회사 도진포스 모바일 장치를 이용한 시험 문제 출력 방법 및 그 장치
CN107203369A (zh) 2016-03-16 2017-09-26 阿里巴巴集团控股有限公司 基于Android的弹框提示方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102063325A (zh) * 2011-01-06 2011-05-18 哈尔滨工业大学 一种嵌入51系列单片机的多任务实时操作系统的实现方法
CN103559035A (zh) * 2013-10-31 2014-02-05 青岛海信移动通信技术股份有限公司 一种应用于Android平台的处理事件的方法和装置
CN104915090A (zh) * 2014-03-13 2015-09-16 宏碁股份有限公司 通知事件呈现方法与电子装置
CN104360794A (zh) * 2014-11-21 2015-02-18 北京奇虎科技有限公司 通过识别全屏模式控制窗口弹出的方法及装置
CN104572110A (zh) * 2015-01-19 2015-04-29 山东大学 一种安卓系统上Toast控件的优化方法

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
HONG, YANG, ANDROID USING ACTIVITY AS POP-UP DIALOG BOX, 7 April 2014 (2014-04-07), pages 1 - 5, XP055577884, Retrieved from the Internet <URL:http://blog.csdn.net/lmj623565791/article/details/23116115> *
See also references of EP3432140A4 *
ZHANG, YONG, DETAILED EXPLANATION FOR ACTIVITY ASSEMBLY OF ANDROID, 22 January 2010 (2010-01-22), pages 3, XP009516108, Retrieved from the Internet <URL:https://www.ibm.com/developerworks/cn/opensourcan.cn.e/osdroid-actvt> *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20200106550A (ko) * 2018-01-29 2020-09-14 후아웨이 테크놀러지 컴퍼니 리미티드 인증 창 디스플레이 방법 및 장치
KR102503514B1 (ko) * 2018-01-29 2023-02-23 후아웨이 테크놀러지 컴퍼니 리미티드 인증 창 디스플레이 방법 및 장치
US12483552B2 (en) 2018-01-29 2025-11-25 Huawei Technologies Co., Ltd. Authentication window display method and apparatus
CN109213582A (zh) * 2018-07-16 2019-01-15 北京奇虎科技有限公司 一种运行服务组件的方法、装置及终端
CN113722035A (zh) * 2021-08-31 2021-11-30 平安消费金融有限公司 弹框任务管理及弹框展示方法、装置、设备和存储介质
CN113722035B (zh) * 2021-08-31 2023-08-22 平安消费金融有限公司 弹框任务管理及弹框展示方法、装置、设备和存储介质

Also Published As

Publication number Publication date
EP3432140A4 (en) 2019-11-20
CN107203369A (zh) 2017-09-26
KR20180125498A (ko) 2018-11-23
EP3432140B1 (en) 2022-02-23
EP3432140A1 (en) 2019-01-23
JP2019516161A (ja) 2019-06-13
US10853102B2 (en) 2020-12-01
PH12018501968B1 (en) 2019-07-15
SG11201807866TA (en) 2018-10-30
KR102194055B1 (ko) 2020-12-23
PH12018501968A1 (en) 2019-07-15
JP6736130B2 (ja) 2020-08-05
US20190012190A1 (en) 2019-01-10
US20200218550A1 (en) 2020-07-09
US10678564B2 (en) 2020-06-09
MY192615A (en) 2022-08-29
TW201734790A (zh) 2017-10-01

Similar Documents

Publication Publication Date Title
WO2017157186A1 (zh) 基于Android的弹框提示方法及装置
CN103577237B (zh) 应用程序启动的控制方法及装置
CN108182131B (zh) 监控应用运行状态的方法、装置、存储介质及电子设备
CN106951335B (zh) 一种进程守护方法和移动终端
CN106528210B (zh) 一种应用程序的运行方法及装置
CN107678782B (zh) 一种进程保护方法、装置、设备以及计算机可读存储介质
CN110865824A (zh) 一种基于无障碍服务实现缄默安装的安卓渗透方法和装置
CN105975320B (zh) 一种第三方应用禁止安装的方法、装置以及终端
WO2017219482A1 (zh) 启动方法和装置
CN111309242A (zh) 一种智能柜屏幕显示方法、装置、服务器及存储介质
CN109783261B (zh) 终端应用的崩溃处理方法及装置、电子设备、存储介质
CN105426703A (zh) 一种应用程序的处理方法及装置
CN111783081A (zh) 一种恶意进程处理方法、终端设备及存储介质
CN110795321A (zh) 误操作处理方法、装置和终端设备
WO2016112602A1 (zh) 快捷操作方法、快捷操作装置和终端
CN110659082A (zh) 应用程序界面的显示方法、装置、终端及存储介质
CN113467981A (zh) 异常处理的方法和装置
CN106126232A (zh) 一种界面启动方法及装置
CN105809027B (zh) 应用程序的权限控制方法及装置
CN106507211A (zh) 来电提示方法及装置
CN109471630B (zh) 一种应用处理方法和设备
CN114020356B (zh) 一种安全关闭服务的方法以及装置
CN117278442A (zh) 边缘服务器诊断方法、装置、设备及存储介质
HK1244562A1 (zh) 基於android的弹框提示方法及装置
CN113110901B (zh) 桌面锁定控制方法及装置

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 11201807866T

Country of ref document: SG

ENP Entry into the national phase

Ref document number: 2018549247

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 20187028698

Country of ref document: KR

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 2017765728

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2017765728

Country of ref document: EP

Effective date: 20181016

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17765728

Country of ref document: EP

Kind code of ref document: A1