Do Android apps need to quit manually?

Source: Internet
Author: User
Keywords Application exit run return key backstage

More than once, more than one person asked the question. I answered: no need. But keep it in the record.

we might start by understanding the system's internal mechanisms for application management.


includes processes and services for the Android system. "Process" has a running, also has just left in the background cache. A "service" is an interface-free, long-running application feature that is not easily terminated.


we know that in Android you can quickly move away from the application by using the home key or the return key (←).


Homepage key: At any interface of the currently running application, pressing the home key will quickly return to the main screen of the mobile phone. At the same time, the process of the application will be paused in the background and the cache is set up, and the application can be easily returned to the interface just now. (the site is retained) of course, when you press the home key to return to the main screen of the mobile phone, it is possible to run one or more processes and services in the background to ensure that the application is "alive" in the background.


Although we know that backstage produces a variety of "processes" and "services", you don't have to worry about them dragging your phone. When running a new application discovers that memory may not be enough, the system automatically frees partially cached processes in the background to ensure that new applications can be run. This is an intelligent, benign supply system.


return key: The Android system uses the return key to screen back and closes the dialog box/menu/On-Screen Keyboard. For traditional local client applications, each screen can be understood as an activity. You can quickly fall back to the previous activity of the current application by returning the key, or you can leave an activity of a new application open by the current application.


all activities are in a stack structure (a serial form of data structure), and the running activity is at the top. When you press the return key, the current activity is cleared and the previous activity is restored. The following diagram example:





(Map Source: http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html)




If you press the return key continuously, the activity is drawn away, just like peeling an onion.


In an Android application, you can start an activity in another application (Task) with an activity in the current application (Task) through the intent feature. For example, the following figure, in the "Youdao Dictionary" main interface click the HYPERLINK "Feedback" to open the browser to access the target page:








in the target Web interface, you can use the return key to quickly return to just the "Youdao dictionary" main interface.


and the next example, the experience is very bad:


as shown above, it takes a few twists to get back to the previous task on the target page. Over and over again the browser's browsing history, and even go back to the browser's start page, and then pop up a dialog box asking if you want to quit ... Oh, my God! I'm going crazy.

Android Official for the activity stack processing mechanism between multiple tasks, you can look at the following diagram to explain:





(Map Source: http://developer.android.com/guide/topics/fundamentals/tasks-and-back-stack.html)





As we can see from the diagram, the "Activity y" of task B in the background was drawn to the front desk by a button in "Activity 2" of task A. And as the activity of task B is stripped down, the entire "task B" is ended and the return key is used to return to activity 2 of task A.




The

return key implements the convenience of quickly returning after invoking a new task, instead of just going back to the application list and finding the last application to start again.




When all activities are cleared from the stack, the task ends. That is, the application exits when the application's main interface presses the return key.
Unless, the application has designed processes and services that run in the background. For example, "Sina Weibo", even if you click the Return key in the application main interface to exit, in the "program Management" > "Running" interface can still see the running processes and services. (You need to switch to the show currently running Services view) by using the menu key




As mentioned above, background service is an interface-free, long-running application that is not easily terminated, even if you use Task Manager. (In fact, you can find it in the "service" interface and manually stop the service, but no such necessity, to the system automatically processing can be. When you don't use a task for a long time, the system thinks you don't need it and will automatically help you end it. )


so far, we already know why Android apps don't need to quit manually. Because Smart systems have helped users do many things, including exiting applications and restoring available memory.


is limited by the official Android approach to design specifications, and Android doesn't explicitly tell designers that they don't need it, as iOS does. The design pattern of the Android application is therefore "blossoming", making it difficult to develop a more unified experience. For example, the topic mentioned in this article is that you don't need to manually exit the Android app, and it's funny if you see a button on your iOS screen that exits the app.


anyway, Android or iOS, users do not need to focus on "process" or "Memory Management", "task management" these things. Run out of the interface can be, so simple! Putting users without attention is tantamount to "not wanting to let children play with fire, but giving him a lighter." ”


and designers, what to do. Change it!


See here, you might ask: Now that the Android app is suspended in the background, why is it slower to open more apps?


On the one hand: new-run applications will be slower if they require larger memory. In addition, if the cell phone itself is too small and the CPU does not give power, the system will naturally automatically end the process of releasing the cache more frequently, resulting in the mobile phone at some times slow to run the feeling. Because of this, we know why Task Manager is so popular, even become a "installed". People use it to quickly release the cache in advance to ensure that there is enough memory to run the new application. Of course, the manual cleanup cache has slowly become unnecessary as the CPU frequency becomes higher and memory grows larger. On the other hand, a temporary background service may cause the phone to slow down. Some applications in the background to listen to the specified events will automatically start, such as the operating system itself, "Google Service", such as the connection between USB and the PC to launch the "Pea Pod Phone Wizard", the cell phone "pea pod daemon" will automatically start. To avoid this, you can only recommend that you have a selective installation of the application. Smart software requires advanced hardware to support it.


You may also ask: Since the application main interface with the return key can be directly out of the application, but why an Android application (especially domestic) to eject the Exit confirmation dialog box?


This is actually more product people out of the hope that their applications are too easy for users to "quit", or worry about "misoperation" reasons, to add to the user a barrier wall. Look at the PC software in front of us! After clicking the X icon in the upper-right corner of the window, there are a lot of software doing the same thing.


that this is a typical way to shift responsibility to the user. Seems to be warning the user: "Really going to quit?" If you're sure, I'll leave you alone! ”


We should use the dialog box as little as possible to provide the necessary fault-tolerant support. Allow users to make mistakes and give them a chance to recover. For example, you can allow users to return to the scene once they have pressed the return key to leave the application. This is reflected in many good third-party apps, such as Twitter, rice chat ...


of course, except for immersive applications. For example, the video is playing or the game is on the screen, should be as far as possible not to let users make mistakes are withdrawn. Immersive applications should provide immersion protection, because the game or movie to half of the exit is often unable to return to the scene.


Finally, add: "Exit" in this article means quitting the application, not the login status of the exit account. If your application requires the user to log in with the password, it is necessary to provide an "exit login" (or "logoff") function.

Source: http://azero.tsang.blog.163.com/blog/static/47005201172411138111/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.