Android Question can 't update app with AppUpdating 2.05

Schakalaka

Active Member
Licensed User
Longtime User
Hello,
i have create the same app with 2 package names, and publish one on play store and one on samsung and huawei store.
Goople play version has been removed.
Now, i would like to "upgrade playstore version to samsung version:

so, in the new play store update apk, I want that the app download the "samsung apk", install it and remove the play store version.
For do this, I have find 2 solutions:
1) AppUpdating by @udg
2) download the new apk with http job


Solution 1:
B4X:
    apkupdt.DownloadApk
    Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
->    apkupdt.InstallApk(Result) ERROR

ERROR:
B4X:
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.clickandclaim.play/files/shared/tmp.apk


Solution 2:


B4X:
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Link)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
       
        Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
        Dim out As OutputStream = File.OpenOutput(functions.rp.GetSafeDirDefaultExternal("shared"), "tmp.apk", False)
        File.Copy2(j.GetInputStream, out)
        out.Close '<------ very important
       
        Wait For (CheckInstallationRequirements) Complete (Result As Boolean)

       
      Dim d As Intent
   
        d.Initialize(d.ACTION_VIEW, "file:///tmp.apk")
        d.SetType("application/vnd.android.package-archive")
       
        StartActivity(d)
    End If
    j.Release


It display the screen "open with" -> "package installer"
but when i select it, it return the error

"Error wile the package analysis"


Any solutions?
 
Last edited:

ddefrain

Member
Licensed User
Longtime User
Hello,
i have create the same app with 2 package names, and publish one on play store and one on samsung and huawei store.
Goople play version has been removed.
Now, i would like to "upgrade playstore version to samsung version:

so, in the new play store update apk, I want that the app download the "samsung apk", install it and remove the play store version.
For do this, I have find 2 solutions:
1) AppUpdating by @udg
2) download the new apk with http job


Solution 1:
B4X:
    apkupdt.DownloadApk
    Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
->    apkupdt.InstallApk(Result) ERROR

ERROR:
B4X:
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.clickandclaim.play/files/shared/tmp.apk


Solution 2:


B4X:
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download(Link)
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
     
        Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
        Dim out As OutputStream = File.OpenOutput(functions.rp.GetSafeDirDefaultExternal("shared"), "tmp.apk", False)
        File.Copy2(j.GetInputStream, out)
        out.Close '<------ very important
     
        Wait For (CheckInstallationRequirements) Complete (Result As Boolean)

     
      Dim d As Intent
 
        d.Initialize(d.ACTION_VIEW, "file:///tmp.apk")
        d.SetType("application/vnd.android.package-archive")
     
        StartActivity(d)
    End If
    j.Release


It display the screen "open with" -> "package installer"
but when i select it, it return the error

"Error wile the package analysis"


Any solutions?
Hello; maybe the downloaded file isn't complete (currupted file), put a sleep let's say 10 seconds in the download section

B4X:
ProgressDialogShow2("Downloading file; Please Wait...",False)
apkupdt.DownloadApk
Sleep(10000)
 ProgressDialogHide
    Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
->    apkupdt.InstallApk(Result) ERROR
 
Upvote 0
Top