Code Monkey home page Code Monkey logo

androidkeepalive's Introduction

杀不死的App

Android 保活实践

前言

  • 什么是保活?保活就是在用户主动杀进程,或者系统基于当前内存不足状态而触发清理进程后,该进程设法让自己免于被杀的命运或者被杀后能立刻重生的手段。
  • 为什么保活:赢得在线时长、实时需求

思路

进程的优先级分为5级(https://zhuanlan.zhihu.com/p/108312672):

  • 前台进程
  • 可见进程
  • 服务进程
  • 后台进程
  • 空进程

主流思路有两个:

  • 提升进程优先级,降低被杀概率
  • 进程被杀后,重新拉起进程

方案(不互斥

实现

https://github.com/sinyu1012/AndroidKeepAlive

总结

没有规矩,不成方圆。保活方案有些太 hack 了,还是尊重用户、提升用户体验才是最重要的。

androidkeepalive's People

Contributors

sinyu1012 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.