PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM24] Utilizing Android APK Expansion Files?
[WM24] Utilizing Android APK Expansion Files?
Débuté par Claire, 15 juil. 2019 18:08 - Aucune réponse
Membre enregistré
48 messages
Posté le 15 juillet 2019 - 18:08
Does anyone have any experience with using APK expansion files?

Right now we are having an issue where upon initialization of our app (first time the app is opened) it downloads images and some information via FTP. For some reason, after it says "downloading photos" the message refreshes and it starts the process of downloading photos again? I am not entirely sure where this problem is occurring and free tech support won't look at my entire app (seeing that I sent them the whole version because I am not sure what bits and pieces are working together at the moment the error occurs.

I was thinking of changing the app to use the APK expansion files process where I can upload a zip file with the APK and access the information that way but there doesn't seem to be any information on what code is needed unless you are using Android Studio.

This is the code, from what I can tell, that is handling the extraction - has any of this language changed between WM 22 and WM 24? I don't receive any error messages at all, just the constant loop around 'downloading photos'

//GET IMAGES: WORKAROUND USING APK EXTENSIONS TO BYPASS 50 MB APK MAX LIMIT

sAPKExtensionFile is string
sAPKExtDir is string
//sDownLoadImagesZip is string
sImageZip is string
nConnection is int


sImageZip = ""
sAPKExtDir = SysDirStorageCard() + "/Android/obb/edu.misin.edu/"
fDelete(sAPKExtDir + ["/"] + "*.obb")

sAPKExtensionFile = sAPKExtDir + "main." + gnAndroidVersion + ".edu.misin.edu.obb"
//sDownLoadImagesZip = gsTempDir + "Images.zip"
IF NOT fDirectoryExist(sAPKExtDir) THEN
fMakeDir(sAPKExtDir)
END

//temporary to test: if it is a real APK extension, do not delete
IF fFileExist(sAPKExtensionFile) THEN
fDelete(sAPKExtensionFile)
END


WHEN EXCEPTION IN
WIN_Extract.STC_Extracting = "Connecting to server..."
Multitask(-1)

nConnection = FTPConnect(gsFTPServer,gsFTPUser,gsFTPPass,gnFTPPort)
IF nConnection <> -1 THEN
gbFirstImageZipDownload = True
WIN_Extract.STC_Extracting = "Downloading Photos..."
Multitask(-1)

fCreate(sAPKExtensionFile)
IF FTPGet(nConnection, gsFTPDownloadDir + "Resources/Images/Images.zip",sAPKExtensionFile,FTPDownloadImagesProgress) = True THEN
sImageZip = sAPKExtensionFile
ELSE
NextTitle("Alert")
Error("Unable to download images from server: " + ErrorInfo(errMessage), "Please try reloading from the Settings page.")
END

ELSE
NextTitle("Alert")
Error("Unable to connect to the server: " + ErrorInfo(errMessage), "Images could not be downloaded.","Please try reloading from the Settings page.")
END
DO
NextTitle("Alert")
Error("Unable to connect to the server: " + HError(), "Images could not be downloaded.","Please try reloading from the Settings page.")
RETURN
END

//unzip
IF NOT sImageZip = "" THEN
ResOpenArchiveImage = zipOpen("ArchiveImage", sImageZip)
IF ResOpenArchiveImage = 0 THEN
// Extract all the files from the archive
ResExtractAllImage = zipExtractAll("ArchiveImage",CompleteDir(fCurrentDir() + "/Resources/Images"))
END
zipClose("ArchiveImage")
END

//temporary to test: if it is a real APK extension, do not delete
IF fFileExist(sAPKExtensionFile) THEN
fDelete(sAPKExtensionFile)
END


// Text that appears on the WIN_Extract page during the above process
WIN_Extract.STC_Extracting = "Extracting resources..."
WIN_Extract.PROGBAR_Populating..Visible = False
Multitask(-1)