/**
* modify file permision
*
* @param apkFile
* @return
*/
private boolean modifyPermision(File apkFile) {
try {
Log
.d(TAG, "/getAbsolutePath//"
+ apkFile.getAbsolutePath());
Process p = Runtime.getRuntime().exec(
"chmod 777 " + PACKAGE_SAVE_PATH);
int status = p.waitFor();
if (status == 0) { // chmod succeed
Log.d(TAG, "//chmod succeed/");
return true;
} else { // chmod failed
Log.d(TAG, "//chmod failed/");
return false;
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* filter type file
*
* @param f
* @return
*/
private String getMIMEType(File f) {
String type = "";
String fName = f.getName();
String end = fName
.substring(fName.lastIndexOf(".") + 1, fName.length())
.toLowerCase();
if (end.equals("m4a") || end.equals("mp3") || end.equals("mid")
|| end.equals("xmf") || end.equals("ogg") || end.equals("wav")) {
type = "audio";
} else if (end.equals("3gp") || end.equals("mp4")) {
type = "video";
} else if (end.equals("jpg") || end.equals("gif") || end.equals("png")
|| end.equals("jpeg") || end.equals("bmp")) {
type = "image";
} else if (end.equals("apk")) {
type = "application/vnd.android.package-archive";
} else {
type = "*";
}
if (end.equals("apk")) {
} else {
type += "/*";
}
return type;
}