PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV Mobile (versiones precedentes) → [WM20] Y-a-t'il moyen de récupérer la date de compilation de l'APK ?
[WM20] Y-a-t'il moyen de récupérer la date de compilation de l'APK ?
Iniciado por Tan Trung, 20,nov. 2017 11:00 - 2 respuestas
Miembro registrado
104 mensajes
Popularité : +1 (1 vote)
Publicado el 20,noviembre 2017 - 11:00
Bonjour,

Existe-t'il sous WM20 une fonction qui retourne la date de compilation/génération de l'APK ?

Merci d'avance

--
NGUYEN Tan Trung
B. Rekencentra NV
Miembro registrado
945 mensajes
Popularité : +102 (110 votes)
Publicado el 23,noviembre 2017 - 15:16
Bonjour
Ce code devrait vous aider
import android.content.Context;
import java.util.zip.ZipFile;
import java.util.zip.ZipEntry;

public static String getAppTimeStamp()
{
String s = "";

try{
Context context = getContexteApplication();
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0);
ZipFile zf = new ZipFile(ai.sourceDir);
ZipEntry ze = zf.getEntry("META-INF/MANIFEST.MF");
long time = ze.getTime();
SimpleDateFormat formatter = (SimpleDateFormat) SimpleDateFormat.getInstance();
formatter.setTimeZone(TimeZone.getTimeZone("gmt"));
s = formatter.format(new java.util.Date(time));
zf.close();
}catch(Exception e){
return s;
}
return s;
}
Miembro registrado
104 mensajes
Popularité : +1 (1 vote)
Publicado el 24,noviembre 2017 - 08:33
Merci beaucoup Philippe, je vais essayer ça tout de suite.

--
NGUYEN Tan Trung
B. Rekencentra NV