Android Question [B4A][AppUpdating 2.02] Invalid double... [SOLVED]

Magma

Well-Known Member
Licensed User
Hi there...

I was testing appupdating library of user udg
https://www.b4x.com/android/forum/threads/appupdating-2-0-update-non-market-apps.98419/

but seems something not going well may be with my .inf file... that have inside only that:
B4X:
ver=1.79
the error that i get is:
** Activity (main) Pause, UserClosed = false **
** Activity (check) Create, isFirst = true **
** Activity (check) Resume **
---- AppUpdating.ReadCurVN
Current Version: 1.78
UpdateComplete - time: 13:52:11
---- AppUpdating.ReadWebVN
java.lang.RuntimeException: java.lang.NumberFormatException: Invalid double: ""
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1707)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5624)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Caused by: java.lang.NumberFormatException: Invalid double: ""
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.parseDouble(StringToReal.java:267)
at java.lang.Double.parseDouble(Double.java:301)
at mvt.client.check$ResumableSub_Activity_Create.resume(check.java:494)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1705)
... 8 more
Logger connected to: LENOVO Lenovo A2010-a
The code related:
B4X:
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Public rp As RuntimePermissions
   Public SharedFolder As String
end sub


Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim apkupdt As cl_appupdate
    Private phone As Phone
    end sub


Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   SharedFolder = rp.GetSafeDirDefaultExternal("")
   DateTime.TimeFormat = "HH:mm:ss"
   DateTime.DateFormat = "yyyy-MM-dd"
 
   
   Activity.LoadLayout("check")
   
   ver.text="Εκδοση: " & Application.VersionName

    If FirstTime=True Then
       apkupdt.Initialize(Me,"update")
       Sleep(500)
       apkupdt.Verbose = True  'this one affects the verbosity of the logs
   
       'ALWAYS NEEDED - this is your app's package name (see "Project/Package name")
       apkupdt.PackageName = "my.myappy"
       'ALWAYS NEEDED - this is the complete path to the text file holding the newer version number
       apkupdt.NewVerTxt = "http://" & myserver r & "/my.inf"
       'ALWAYS NEEDED - this is the complete path to your newer apk
       apkupdt.NewVerApk = "http://" & myserver & "/my.apk"
       apkupdt.ReadCurVN 'no diff if i removed it
       apkupdt.ReadWebVN 'no diff if i removed it 
       
       If apkupdt.CurVN < apkupdt.WebVN Then 'no diff if i removed it
           ToastMessageShow("Υπάρχει νέα έκδοση MVT - συγκεκριμένα: " & apkupdt.WebVN & " -  παρακαλώ ανβαθμίστε...",True)  'no diff if i removed it
       End If 'no diff if i removed it
     end if
...
end sub

Sub Button3_Click
   'OPTIONAL - if you like to show a splash screen while checking for a newer apk goes on
   Activity.RemoveAllViews
   Sleep(2000)
   Wait For (CheckInstallationRequirements) Complete (Result As Boolean)
   'OPTIONAL - if you like to show a splash screen while checking for a newer apk goes on
   apkupdt.SetAndStartSplashScreen(Activity,LoadBitmap(File.DirAssets, "updating.jpg"))
   'NEEDED - this is the one you need if you want to perform "automatic" updating of your apk
   apkupdt.UpdateApk(Result) 'checks for newer apk, downloads it and asks the user to install it
   Sleep(2000)


End Sub

Sub update_UpdateComplete

   Log($"UpdateComplete - time: ${DateTime.Time(DateTime.Now)}"$)
   apkupdt.StopSplashScreen
   'too lazy to manage error conditions..check apkupdt.ERR_xxx codes if you like
   Select apkupdt.Status
       Case apkupdt.OK_CURVER
           ToastMessageShow("Έκδοση που έχετε:" & apkupdt.CurVN,True)
       Case apkupdt.OK_WEBVER
           ToastMessageShow("Έκδοση στον Server:" & apkupdt.WebVN,True)
       Case apkupdt.OK_NEWERAPK
           ToastMessageShow("Υπάρχει νέοτερη έκδοση !!!",True)
       Case apkupdt.NO_NEWERAPK
           ToastMessageShow("Δεν υπάρχει νεότερη έκδοση ! - Έχετε την τελευταία.",True)
           Sleep(5000)
           ExitApplication
       Case apkupdt.OK_DOWNLOAD
           ToastMessageShow("Η νεότερη έκδοση κατέβηκε !",True)
       Case apkupdt.OK_INSTALL
           ToastMessageShow("Εγκατάσταση νέας εφαρμογής...",True)
       Case apkupdt.ERR_NOPERM
           ToastMessageShow("Δεν έχουν δοθεί δικαιώματα...",True)
       Case Else
           ToastMessageShow(apkupdt.status,True)
   End Select
End Sub



#Region version-safe-apk-installation
'https://www.b4x.com/android/forum/threads/version-safe-apk-installation.87667/

'Check whether we already have permission for install other apps.
'If not we open the relevant settings page
'then wait for Activity_Resume and check the value of CanRequestPackageInstalls again
Private Sub CheckInstallationRequirements As ResumableSub
   If File.ExternalWritable = False Then
       MsgboxAsync("Αποθηκευτικός χώρος μη διαθέσιμος! Επιβεβαιώστε ότι η συσκευή σας δεν είναι συνδεδμένη με USB/PC και ότι έχετε δώσει πλήρη δικαιώματα στην εφαρμογή!", "")
       Return False
   Else If phone.SdkVersion >= 26 And apkupdt.CanRequestPackageInstalls = False Then
       MsgboxAsync("Παρακαλώ δώστε άδεια για εγκατάσταση εφαρμογών!", "")
       Wait For Msgbox_Result(Result As Int)
       Dim in As Intent
       in.Initialize("android.settings.MANAGE_UNKNOWN_APP_SOURCES", "package:" & Application.PackageName)
       StartActivity(in)
       Wait For Activity_Resume '<-- wait for Activity_Resume
       Return apkupdt.CanRequestPackageInstalls
   Else If apkupdt.CheckNonMarketAppsEnabled = False Then
       MsgboxAsync("Παρακαλώ ενεργοποιήστε την εγκατάσταση από Άγνωστες Πηγές!" & CRLF & "Ρυθμίσεις - Ασφάλεια - Άγνωστες Πηγές" _
            & CRLF & "ή Ρυθμίσεις - Εφαρμογές -  Άγνωστες Πηγές", "")
       Return False
   Else
       Return True
   End If
End Sub
#End Region
 
Top