![]() Var status = extras.GetInt(PackageInstaller.ExtraStatus) If ("SESSION_API_PACKAGE_INSTALLED".Equals(intent.Action)) Protected override void OnNewIntent(Intent intent) StartActivity(new Intent(,Ī("package:" + .PackageName))) If (PackageManager.CanRequestPackageInstalls() = false) Toast.MakeText(this, "No Package Installer Permission", ToastLength.Long).Show() IntentSender statusReceiver = pendingIntent.IntentSender PendingIntent pendingIntent = PendingIntent.GetActivity(this, 0, intent, 0) Intent.SetAction("SESSION_API_PACKAGE_INSTALLED") Intent intent = new Intent(Application.Context, Class) ![]() Throw new Exception("Inputstream is null") Var packageInSession = session.OpenWrite("package", 0, -1) Var httpResponse = await new HttpClient().GetAsync(url, HttpCompletionOption.ResponseContentRead) Var session = packageInstaller.OpenSession(sessionId) Int sessionId = packageInstaller.CreateSession(sessionParams) Var sessionParams = new PackageInstaller.SessionParams(PackageInstallMode.FullInstall) Var packageInstaller = PackageManager.PackageInstaller If (PackageManager.CanRequestPackageInstalls() = true) Does it even work? Maybe there are some features? I also get permissions to install packages. But this does not problem, I tried it from the file. The example is redesigned for recording into a session from the stream http of the request, and in original from a file. On the output OnNewIntent I always get the result - PackageInstallStatus.FailureInvalid. I found only one example using PackageManager but unfortunately nothing works. Up to version android 10, I updated the application by downloading it through DownloadManager and installed through Intent by running it in StartActivity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |