PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
update android app automatically
update android app automatically
Started by Tiago, Mar., 14 2019 11:37 AM - 1 reply
Connect yourself…
Tiago
#1
Posted on March, 14 2019 - 11:37 AM
Hello everyone
I'm here to ask if someone knows how to download and install a new version of a apk.
FTPGets() only works in system folders and i can't download to an main storage folder.
Even if I mannually download the apk to downloads folder, Cant even install use ShellExecute()
thank you
Report
0
0
Willian Fernando
#2
Registered member
123 messages
Popularité : +46 (46 votes)
Posted on March, 18 2019 - 10:25 PM
Try use HTTPREQUEST, and put your file in Public URL,
Example code (in use by myself)
WHEN EXCEPTION IN
//gs_url_endpoint is GLOBAL VARIABLE, Example = https://mydomain.com
PROGBAR_progreso
..
Visible
=
True
//PROGBAR_progreso is a ProgressBar Control in Window.
HTTPProgressBar
(
PROGBAR_progreso
)
Ok
is boolean
=
HTTPRequest
(
gs
_url_endpoint
+
"/updates/myapp.apk"
)
IF
Ok
=
True
THEN
s
_filename
is string
IF
SysStatusExternalStorage
(
1
) =
sseAvailable
THEN
s
_filename
=
CompleteDir
(
SysDirExternalStorage
(
1
,
ssePublicDownload
)
)
+
"apptmp.apk"
ELSE
s
_filename
=
CompleteDir
(
fDataDir
(
)
)
+
"apptmp.apk"
END
FileDownloading
is
Buffer
=
HTTPGetResult
(
)
Ok
=
fSaveBuffer
(
s
_filename
,
FileDownloading
)
OkFile
is boolean
=
fFileExist
(
s
_filename
)
IF
Ok
=
True
AND
OkFile
=
True
THEN
IF
ShellExecute
(
s
_filename
)
THEN
//code on ShellExecute OK
ELSE
PROGBAR_progreso
..
Visible
=
False
Error
(
"Oops.."
,
"Error on Install App"
)
RETURN
END
ELSE
PROGBAR_progreso
..
Visible
=
False
Error
(
"Error On Download File"
)
RETURN
END
ELSE
PROGBAR_progreso
..
Visible
=
False
Error
(
"Error On Download File"
)
RETURN
END
DO
Error
(
"Fatal Error"
,
ExceptionInfo
(
errFullDetails
)
)
RETURN
END
P.D: Files downloaded with FTP if it can be stored in SDCARD (Check the help)
--
Atte. Willian Fernando
Report
1
0
→ Go back to WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text