GithubHelp home page GithubHelp logo

tchigher / signal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from testplanb/signal

0.0 0.0 0.0 268 KB

library for android which can observe signal from native crash or ANR

C++ 31.35% Kotlin 48.87% CMake 19.78%

signal's Introduction

Signal

Android信号处理,兼容native crash 与anr,提供安全气囊方案与监控方案的基础设施,目前已添加native堆栈日志的回调,既可以当crash监控,又可以当安全气囊,开发你的脑洞吧!

详细介绍

https://juejin.cn/post/7114181318644072479 https://juejin.cn/post/7118609781832548383

使用说明

目前还在更新中,后续会发到maven

本地使用

该项目可以用于本地配置使用,只需拷贝lib_signal这个module到自己的项目即可,请按照以下条件使用

1.拷贝lib_signal这个module到自己的项目

2.初始化SignalController对象,然后调用initWithSignals 初始化想要监听的信号,参数是int数组,内容为具体的信号值,比如

SignalController(this).initWithSignals(intArrayOf(SignalConst.SIGQUIT,SignalConst.SIGABRT))

3.创建一个实现CallOnCatchSignal接口的类,重写onCatchSignal方法,里面是自定义的信号处理逻辑

参数1是回调的context 参数2是崩溃时的信号值 参数3是native的堆栈日志
onCatchSignal(context: Context,signal: Int, nativeStackTrace:String)

4.创建一个路径为resources/META-INF/services的目录,并在目录下创建一个文件,名称为com.example.lib_signal.CallOnCatchSignal,内容为继承了 CallOnCatchSignal接口的实现类路径名称,如app例子项目所示。

项目层级介绍

  • app下是使用例子
  • lib_signal 是Signal的封装实现

环境准备

建议直接用最新的稳定版本Android Studio打开工程。目前项目已适配Android Studio Arctic Fox | 2020.3.1

signal's People

Contributors

testplanb 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.