What's the behavior of App killed or restored by Android System or by users?



First, user kills the app by swiping out the screen

The DEMO process is killed and activity stack is cleared. And the system will relaunch the DEMO process automatically.  When user launch the app, it will just likes user taps App icon in home screen.

Second, user force to stop the app on the app information page

The DEMO process is killed and activity stack is cleared. When user launches the app,  it will just likes user taps App icon in home screen.

Third,Killed/restored by system when there’s insufficient memory.

Two behaviours,

1. If DEMO app is running in background (press home button to move DEMO task to background).

For example, go to about -> what’s new , stay in what’s new screen, then press the home menu to move DEMO app to background, the activity stack is:

TaskRecord{671c710 #129 A=com.demo.android U=0sz=3}

        Run #7: ActivityRecord{1f2503f6 u0com.demo.android/.whatsnew.WhatsNewActivity t129}

        Run #6: ActivityRecord{10cbd46 u0com.demo.android/.settings.About t129}

        Run #5: ActivityRecord{867b18f u0com.demo.android/.main t129}

Then kill the DEMO process, system will relaunch the DEMO process automatically, but the activity stack does not be restored, the task record is empty,

TaskRecord{671c710 #129 A=com.demo.android U=0 sz=3}

Then  relaunch the DEMO app from launcher, the task record is:

TaskRecord{671c710 #129 A=com.demo.android U=0 sz=4}

        Run #5: ActivityRecord{229cb1f7 u0com.demo.android/.main t129}

We see here system will launch the root activity (main)instead of keep the last activity (WhatsNewActivity).

2. If DEMO app is running, and switch to other app from notification. 

Follow the same flow of case 1. Keep in what’s new screen:

TaskRecord{671c710 #129 A=com.demo.android U=0 sz=3}

        Run #7: ActivityRecord{69eb835 u0com.demo.android/.whatsnew.WhatsNewActivity t129}

        Run #6: ActivityRecord{2ca853c5 u0com.demo.android/.settings.About t129}

        Run #5: ActivityRecord{867b18f u0com.demo.android/.main t129}

Kill DEMO app, system will relaunch the demo process automatically.Press back key to return DEMO app.

TaskRecord{671c710 #129 A=com.demo .android U=0 sz=3}

        Run #5: ActivityRecord{69eb835 u0com.demo.android/.whatsnew.WhatsNewActivity t129}

We see here we still stay in the What’s new screen, press back will back to about screen. System will restore the activity stack. However,because the new process lose all global data, such as auth status, and otherdata in memory, so the DEMO will be in a
wrong status.

Finally,I trigger the scenario  "system is lack of memory", and we can learn that  Both UI process and Service
process of DEMO app killed /restored bysystem when in low memory, and the activity stack will be empty, once it restored by system, it just likes user taps demo app icon in home screen.

The behavior of App killed or restored by Android System or by users的更多相关文章

  1. [Tool] 取得APP的Store URL Scheme (Android、iOS)

    [Tool] 取得APP的Store URL Scheme (Android.iOS) 前言 在企业网站中,如果希望使用URL连结的方式,开启Store APP来下载APP(非网页下载).开发人员可以 ...

  2. 命令行下使用javah命令生成.h文件,出现“错误: 无法访问android.app.Activity 找不到android.app.Activity的类文件”的解决方法

    在学习NDK中,当我在项目的bin/classes目录下使用javah命令生成头文件时,出现了“错误: 无法访问android.app.Activity 找不到android.app.Activity ...

  3. 【转】can't find referenced method 'android.app.RemoteInput[] getRemoteInputs()' in class android.app.Notification$Action

    原文网址:http://stackoverflow.com/questions/25508735/cant-find-referenced-method-android-app-remoteinput ...

  4. 微信授权登陆接入第三方App(步骤总结)Android

    微信授权登陆接入第三方App(步骤总结)Android Android App实现第三方微信登录

  5. wemall app商城源码中android按钮的三种响应事件

    wemall-mobile是基于WeMall的android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享wemall app商城源码中android按 ...

  6. 写给Android App开发人员看的Android底层知识(8)

    (十)PMS及App安装过程 PMS,全称PackageManagerService,是用来获取Apk包的信息的. 在前面分析四大组件与AMS通信的时候,我们介绍过,AMS总是会使用PMS加载包的信息 ...

  7. Windows Phone App的dump文件实例分析- System.ExecutionEngineException

    前言 在开始这篇文章之前我们先来讲讲如何从高度优化的Release版的Dump中找到正确的异常上下文地址,并手动恢复异常发生的第一现场. 1. 什么是异常上下文 简单来说,在windows体系的操作系 ...

  8. 将报表移动端集成到自有移动端app方法【IOS、Android】

    应用场景 用户有自己的app,希望把报表的移动端[本文中以FineReport移动端为例]功能集成到他们的app里面去,而不需要安装两个app.Android端和IOS端的集成接口是不一样的,下面我们 ...

  9. 仿各种APP将文章DOM转JSON并在APP中以列表显示(android、ios、php已开源)

    背景 一直以来都想实现类似新闻客户端.鲜城等文章型app的正文显示,即在web editor下编辑后存为json,在app中解析json并显示正文. 网上搜过,没找到轮子.都是给的思路,然后告知是公司 ...

随机推荐

  1. (转)OpenCV 基本知识框架

    以下是对<学习OpenCV>一书知识框架的简单梳理 转自:http://blog.chinaunix.net/uid-8402201-id-2899695.html 一.基础操作      ...

  2. Gym - 100502A Amanda Lounges

    Amanda Lounges Time Limit: 1000MS   Memory Limit: 524288KB   64bit IO Format: %I64d & %I64u AMAN ...

  3. Android学习笔记进阶21之设置壁纸

    别忘记在ApplicationManifest.xml 中加上权限的设置. <uses-permission Android:name = "android.permission.SE ...

  4. php课程 12-38 php的类的构造方法和析构方法怎么写

    php课程 12-38 php的类的构造方法和析构方法怎么写 一.总结 一句话总结:a.__construct(参数){},__destruct(){},b.如果类中的一个方法和类名相同,则该方法为构 ...

  5. Math的三个取整方法。

    Math类中提供了三个与取整有关的方法:ceil.floor.round,这些方法的作用与它们的英文名称的含义相对应 1.ceil的英文意义是天花板,该方法就表示向上取整,所以,Math.ceil(1 ...

  6. Linux下PortSentry的配置

    Linux下PortSentry的配置       前年写过<IDS与IPS功能分析>一文,受到广大读者关注,现将近期有关IDS配置的文章和大家分享.    Internet上的服务器一般 ...

  7. vue中类名和组件经过刷新不对应的解决办法

    方法一: 页面路由如下: index.js路由文件如下: { path: '/myOrder', name: '我的订单', menuShow: true, component: myOrder, c ...

  8. 免费的EmBitz可替代Keil MDK开发STM32、NXP项目

    一.背景 由于使用之前开发STM32是基于Keil MDK编译环境开发的,由于该软件是收费的,想用个免费开源的软件来替代Keil,EmBitz编译器是免费的,可以完全替代开发.下载程序支持J-Link ...

  9. PHP盛宴——经常使用函数集锦

    近期写了蛮多PHP,也接触到挺多经常使用的函数,大多都记了笔记,发个博客出来.共同学习.事实上感觉学习一门语言,语法逻辑是软素养.而对语言的熟悉程度仅仅能随着使用时间的增长而慢慢增长,当对一门语言的函 ...

  10. Android开机自动运行APP——BroadcastReceiver

    前言: 有些时候,应用需要在开机时就自动运行,例如某个自动从网上更新内容的后台service.怎样实现开机自动运行的应用?在撰写本文时,联想到高焕堂先生以“Don't call me, I'll ca ...