Code example for ZipFile

Methods: getEntry

0
		boolean toRet = false;
		if(pi != null){
			ApplicationInfo ai = pi.applicationInfo;
			ZipFile zf;
				try { 
					zf = new ZipFile(ai.sourceDir);
					//check for the existence of a DSA or RSA file, which will be the public key of whatever we're supposedly signed with  
					ZipEntry ze = zf.getEntry("META-INF/CERT.DSA");
					ZipEntry zr = zf.getEntry("META-INF/CERT.RSA");
					//TODO: enumerate through META-INF and check for *.RSA/*DSA, since we can be signed with multiple files and there's no guarantee for names. 99.999% of people will just sign once though.  
					toRet = (ze != null) || (zr != null);
				} catch (IOException e) {
					e.printStackTrace();
				} 
		} 
		return toRet;
	} 
	 
	/** 
	 * Static call to check if we are running in the emulator (a.k.a. development), 
	 * @param context The Context we are checking to be running in the emulator