Android Question Update Android App

Blaupunkt

Member
Licensed User
Hello,

i'am writing a app, now I've got a question.

I am at the topic "update".

This is the code to call my "update file".

B4X:
Dim i As Intent
        i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirdefaultExternal, "Test.apk"))
    i.SetType("application/vnd.android.package-archive")
        StartActivity(i)

However, I always get an error message, which is: "Parsing error ... Error while parsing the package"

What am I doing wrong?

Thank you

greeting
 

Blaupunkt

Member
Licensed User
B4X:
 FTP1.Initialize("FTP", "xxx", 21, "xxx", "xxx")
   FTP1.UseSSL = False
   FTP1.PassiveMode = False
   If FTP1.IsInitialized = False Then
     Msgbox("Kann keine Verbindung herstellen, Update nicht möglich!","Fehlermeldung")
     Else
     FTP1.DownloadFile("/Daten/Daten/Excel Projekte/Ausbilder/Test.apk", True, "/storage/extSdCard/Ausbilder/", "Test.apk")

On my Server the File has the following Size:

Size: 2,14 MB (2.254.148 Bytes)
Size on HDD: 2,15 MB (2.256.896 Bytes)

With ES Explorer, it's the same Size (2.254.148 Bytes). After the transfer with my APP i got this Size: 2,15 MB (2.254.116 Bytes)

That seems to be the problem. What went wrong?

Greeting
 
Upvote 0

Blaupunkt

Member
Licensed User
B4X:
Sub Label8_Click
    FTP.Initialize("FTP", "xxx", 21, "xxx", "xxx")
    FTP.UseSSL = False
    FTP.PassiveMode = True
    If FTP.IsInitialized = False Then
        Msgbox("Kann keine Verbindung herstellen, Update nicht möglich!","Fehlermeldung")
        Else
        FTP.DownloadFile("/Daten/Daten/Excel Projekte/Ausbilder/Test.apk", True, "/storage/extSdCard/Ausbilder/", "Test.apk")
        End If
    End Sub

Sub ftp_Downloadcompleted (ServerPath As String, Success As Boolean)
    If Success = True Then
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, "file://" & File.Combine("/storage/extSdCard/Ausbilder/", "Test.apk"))
    i.SetType("application/vnd.android.package-archive")
        StartActivity(i)
        Dim j As Int: j = 1
        Main.SQL6.ExecNonQuery("UPDATE table6 Set Version = '"&Main.build1&"' WHERE ID = '"&j&"'")
        Msgbox("Update erfolgreich ausgeführt!","Information")
        FTP.Close
Else
        Msgbox("Kann keine Verbindung herstellen, Update nicht möglich!","Fehlermeldung")
        End If
End Sub

Same problem, the file has not the right size. Is the code right now or any errors?

Greeting
 
Upvote 0
Top