1

I am trying to update my app programmatically.

I am able to download the new version of the app apk.

But when the installation code runs nothing happens except an activity that is opened and then closed returning to my app

The installation code is

            Java.IO.File apkFile = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/download/" + "com.tri.GOT.apk");

            var context = Android.App.Application.Context;

            var downloadUri = FileProvider.GetUriForFile(context, "com.tri.GOT.fileprovider", apkFile);
            Intent install = new Intent(Intent.ActionView);
            install.AddFlags(ActivityFlags.NewTask);
            install.AddFlags(ActivityFlags.GrantReadUriPermission);
            install.AddFlags(ActivityFlags.GrantWriteUriPermission);
            install.AddFlags(ActivityFlags.GrantPersistableUriPermission);
            install.SetDataAndType(downloadUri, "application/vnd.android.package-archive");
            context.StartActivity(install);
Shura Capricorn
  • 119
  • 1
  • 9

0 Answers0