Skip to content

Instantly share code, notes, and snippets.

View AlanCheen's full-sized avatar
🤩
Working on Flap v3

程序亦非猿 AlanCheen

🤩
Working on Flap v3
View GitHub Profile
@AlanCheen
AlanCheen / OomExceptionHandler.java
Created January 22, 2017 06:23 — forked from pyricau/OomExceptionHandler.java
Dump the heap on OutOfMemoryError crashes in your debug builds.
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
@AlanCheen
AlanCheen / KeepAliveService.java
Created January 22, 2017 03:23
Service利用 bug 进行灰色保活
/**
* 灰色保活
*/
public class KeepAliveService extends Service {
private static final int SERVICE_ID = 666;
public KeepAliveService() {
@AlanCheen
AlanCheen / build.gradle
Last active September 23, 2016 11:49
用gradle检测每个cpu架构下的so数量是否一致
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
import java.util.List
apply plugin: 'com.android.application'
task checkJni <<{
def dir = new File(project.buildDir.absolutePath+"/outputs/apk")
@AlanCheen
AlanCheen / AppReceiver
Created September 14, 2015 07:46
监听应用的安装卸载升级
public class AppReceiver extends BroadcastReceiver{
public static final String TAG = "AppReceiver";
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
String packageName = intent.getData().getSchemeSpecificPart();
Log.d(TAG, "ACTION_PACKAGE_ADDED:" + packageName);