This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom Application which can detect application state of whether it enter | |
* background or enter foreground. | |
* | |
* @author shuang | |
* @reference http://www.vardhan-justlikethat.blogspot.sg/2014/02/android-solution-to-detect-when-android.html | |
*/ | |
public abstract class StatusApplication extends Application implements ActivityLifecycleCallbacks { | |
public static final int STATE_UNKNOWN = 0x00; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.os.Environment; | |
import android.text.TextUtils; | |
import java.io.BufferedOutputStream; | |
import java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.ByteArrayOutputStream; | |
import java.io.File; | |
import java.io.FileOutputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.annotation.ElementType; | |
import java.lang.annotation.Inherited; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
/** | |
* A annotation which to indicate the method is called by native code. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.ActivityNotFoundException; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.net.Uri; | |
import android.os.Build; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.widget.AppCompatTextView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
old="onFailure(MetaCode" | |
new="onFailure(int" | |
# sed -i "s/$old/$new/g" `grep $old -rl $1` | |
# sed -i -e "s/$old/$new/g" `ls` | |
#The sed command is a bit different in Mac OS X, the ‘-i’ option | |
# required a parameter to tell what extension to add for the backup file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ $# -lt 2 ] ;then | |
echo "Please specify a key store" | |
exit 0 | |
fi | |
if [ $# -lt 3 ] ;then | |
echo "Please specify a source unsigned apk file" | |
exit 0 | |
fi |
NewerOlder