PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM22] Android Installing APKs from inside an app
[WM22] Android Installing APKs from inside an app
Débuté par Robert, 18 jan. 2018 16:53 - 3 réponses
Membre enregistré
105 messages
Posté le 18 janvier 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!
Membre enregistré
105 messages
Posté le 19 janvier 2018 - 16:19
I figured out this can be done using the ShellExecute() function.
Membre enregistré
794 messages
Popularité : +40 (42 votes)
Membre enregistré
28 messages
Popularité : +2 (2 votes)
Posté le 26 janvier 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