Android Question SQLITE DB WLAN - LTE - OFFLINE Problems

gerredtor

Active Member
Licensed User
Hello,
I have got a problem with my app. Everytime it starts there will be downloaded a sqlite db in dirinternal with a size of about 500kb
If the app will be used with wlan then everything is ok, but when wlan is turned off then the startscreen doesnt appear completly and the app hungs up during the download und then starts with errors or not at all.
If I try then to start it offline (the db has been downloaded and should have been able to be read) then the start screen is hanging in a corner and the complete app starts as if the db would be empty.

This is my appstart code:

B4X:
Sub Activity_Create(FirstTime As Boolean)   
    If FirstTime Then
          manager.Initialize("manager", key)
           manager.DebugLogging = True
               
        aplayer.Initialize
        timer.Initialize("Timer1", 100)
        'tracker.Initialize   
    End If
       
    If isFirstStart Then
            Dim jo As JavaObject
            jo.InitializeStatic("java.util.Locale")
            Log(jo.RunMethodJO("getDefault", Null).RunMethod("getLanguage", Null))
            speak = 2
            setSavedSpeak(speak)
            speak = loadSpeak
        Else
            speak = loadSpeak       
    End If
   
    Width = GetDeviceLayoutValues.Width
    Height = GetDeviceLayoutValues.Height
   
    If FirstTime Then
            If Premium Then
        Else
            adMobMinus = True
            Height = Height - getAdMobHeight
        End If
    End If
   
    Activity.LoadLayout("main")

    Panel1.Width = GetDeviceLayoutValues.Width
    Panel1.Height = GetDeviceLayoutValues.Height
    Panel1.Top = 0
    Panel1.Left = 0

    setupLoadingScreen
End Sub

Sub setupLoadingScreen
    page = 1
   
    Dim iv As ImageView
    iv.Initialize("")
    Panel1.AddView(iv, 0, 0, Width, Height)
    iv.Bitmap = sResizeBitmap(LoadBitmap(File.DirAssets, "screen.png"), Width, GetDeviceLayoutValues.Height)

    tim.Initialize("LoadTimer", 2000)
    tim.Enabled = True
End Sub

Sub LoadTimer_Tick

    tim.Enabled = False
    If pruefeInternetConnection Then
            StartService(Starter)
        Else
           
        sql.Initialize("tracks")
           
        favoriet.Initialize
        playlistt.Initialize
   
           
            Msgbox(sql.getString(19,speak), "")
            Wait(1000)
            setupPage2
    End If
End Sub

The Service Starter is the download service for the sqlite db file
 

gerredtor

Active Member
Licensed User
B4X:
Sub Wait(Miliseconds As Int)
   Dim Ti As Long
   Ti = DateTime.Now + Miliseconds
   Do While DateTime.Now < Ti
   Loop
End Sub

Yes this is the block code.
 
Upvote 0
Top