PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV Mobile 2024 → [WM22] Android Installing APKs from inside an app
[WM22] Android Installing APKs from inside an app
Iniciado por Robert, 18,ene. 2018 16:53 - 3 respuestas
Miembro registrado
105 mensajes
Publicado el 18,enero 2018 - 16:53
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!
Miembro registrado
105 mensajes
Publicado el 19,enero 2018 - 16:19
I figured out this can be done using the ShellExecute() function.
Miembro registrado
794 mensajes
Popularité : +40 (42 votes)
Miembro registrado
28 mensajes
Popularité : +2 (2 votes)
Publicado el 26,enero 2018 - 11:58
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