PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
[WM22] Android Installing APKs from inside an app
[WM22] Android Installing APKs from inside an app
Started by Robert, Jan., 18 2018 4:53 PM - 3 replies
Connect yourself…
Robert
#1
Registered member
105 messages
Posted on January, 18 2018 - 4:53 PM
Does anyone know if it's possible to say have an android app download an APK file and install it? (obviously would require the allow unknown sources option to be turned on)
The reason I'm asking, is we're looking at some industrial android devices, and some of them don't come with the Google services installed (no play store access)
So i'm trying to figure out an alternative way to distribute updates.
Thanks!
Report
0
0
Robert
#2
Registered member
105 messages
Posted on January, 19 2018 - 4:19 PM
I figured out this can be done using the ShellExecute() function.
Report
0
0
Rubén Sánchez Peña
#3
Registered member
797 messages
Popularité : +40 (42 votes)
Posted on January, 23 2018 - 5:03 PM
Hi. You must use Java for this:
https://stackoverflow.com/questions/4604239/install-application-programmatically-on-android
https://stackoverflow.com/questions/4967669/android-install-apk-programmatically
Rubén
Report
0
0
Joey Dieleman
#4
Registered member
28 messages
Popularité : +2 (2 votes)
Posted on January, 26 2018 - 11:58 AM
Hi!
ShellExecute should work, but here I have a java example (to upgrade).
com.xxxx.myapp is de name of the application
PATH_TO_FILE_APK is the full path of the apk you want to install.
PUBLIC static
void Java_Install_APK
(
string
PATH_TO_FILE_APK
)
{
import android.net.Uri
;
import android.content.Intent
;
Uri uri
=
Uri.fromFile
(
new File
(
PATH_TO_FILE_APK
)
)
;
Intent intent
=
new
Intent
(
Intent.ACTION_VIEW
)
;
intent.putExtra
(
"Intent.ACTION_PACKAGE_REPLACED"
,
"com.xxxx.myapp"
)
;
intent.setDataAndType
(
uri
,
"application/vnd.android.package-archive"
)
;
getCurrentActivity
(
)
.
startActivity
(
intent
)
;
}
Regards,
Joey
Report
0
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