Android Question My app is freezing on realme mobiles

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Freinds,

After downloading my recently updated app users are not able to run the app.It is freezing.
Has anyone faced this issue.The mobiles having issues are Realme, Vivo and Nokia.

Pls guide if possible.

Thanks
Juzer
 

DonManfred

Expert
Licensed User
Longtime User
My car does not work. What is the problem? I guess you can´t help as i am not giving any useful information.

Same here. You are not providing any helpful info.

Upload your project. Describe in detail what you are doing at appstart.
 
Last edited:
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
When starting the app downloads data (from SQL server to SQLite) successfully, Finally it starts a service where i guess it freezes.
In the service it is initializing FTP and Media Browser. I will come to know tomorrow. But if indeed this is the issue I will need to have some workaround.

Juzer
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
App is not running at all. Immediately after installing it freezes on first activity itself.In Samsung Galaxy A5 also its not working.
It is working in Samsung M10. Now i remember for google update i changed manifest line. Below is the code also.

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" maxSdkVersion="26" />

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
   
    Activity.LoadLayout("LO_Welcome")
    lblversion.Text="Ver. No. 1.55       Rel. Sep - 2019"
    lblversion.TextSize=10
   
    'create directory if not present
    'File.Delete(File.DirInternal&"/MyAppxyz/Database/","xyz.db")
   
    If File.IsDirectory(File.DirInternal,"xyz")=True Then
        If File.IsDirectory(File.DirInternal& "/xyz","Metafiles")=True Then
       ' do nothing
       Else
            File.MakeDir(File.DirInternal& "/xyz","Metafiles")
       End If
        If File.IsDirectory(File.DirInternal& "/xyz","Database")=True Then
       ' do nothing
       Else
            File.MakeDir(File.DirInternal& "/xyz","Database")
       End If
        If File.IsDirectory(File.DirInternal& "/xyz","Temp")=True Then
            ' do nothing
        Else
            File.MakeDir(File.DirInternal& "/xyz","Temp")
        End If
    Else       
        File.MakeDir(File.DirInternal, "xyz")
        File.MakeDir(File.DirInternal& "/xyz","Metafiles")
        File.MakeDir(File.DirInternal& "/xyz","Database")
        File.MakeDir(File.DirInternal& "/xyz","Temp")
    End If
   
   
End Sub

Sub btnLogin_Click
    Dim ServerURL As String=""
    ServerURL="http://xxx.com/yyy.aspx"
   
    If File.Exists(File.DirInternal&"/xyz/Database", "xyz.db") = False  Then
            job1.Initialize("Job1",Me)
            job1.Download2(ServerURL,Array As String("Cmpycode","100")) 
            Return
    End if
End Sub


Sub Jobdone(Job As HttpJob)
If Job.Success =True Then
Select Job.JobName
    Case "Job1"
    If job1.GetString.Contains("Names") Then
        job1.Release 
        StartActivity("frmLogin") 
    Else 
        bFlagInternetConnection=False
        ToastMessageShow("Internet Connection Not Found",bFlagInternetConnection)
    End If
End Select
End If
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upload a SMALL example which shows the issue. Hard to help without.
elect Job.JobName
Case "Job1"
If job1.GetString.Contains("Names") Then
job1.Release
StartActivity("frmLogin")
Else
bFlagInternetConnection=
False
ToastMessageShow("Internet Connection Not Found",bFlagInternetConnection)
End If
End
Select
you are starting another activity without using the result from the call?
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Erel,
Nothing happens.It does not give any error msg also.This code has been working without any problems. I guess some thing is wrong with manifest code.
Juzer
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Erel, You are correct its not freezing(sorry), But the Job should execute as DB file is not there first time and its not executing.

Juzer
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
do a

B4X:
log(job.success)
log(job.errormessage)
log(job.response) 'this might crash the app as there will be no response in some case

as first thing in the sub.

if it fails it's normal that it skips the rest but then you might get some hint what is going on.
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Its been stated several times across various threads in this forum, with newer SDK targets, that requesting external write permissions and writing to an external source has changed a tiny bit from SDK to SDK.

I think you have to use runtimepermissions and request the write external storage permission, not just add it to the manifest. Also, you need the getsafedirexternal directive in your code as well.

None of this is shown as what you have shown so far is writing to DirInternal, which is fine as it doesnt use that permission.

So I am only speculating, but if thats the only thing you changed was to target a higher SDK, then thats likely your issue. the database file cant be written so your app cant do anything.
 
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi techknight,
Thanks for your observation.
I was using EXTERNAL STORAGE until the permission issue came up, Now i am using DirInternal only.
I only changed SDK to 28.
On Login Button click
Checks for DB file
if not found tries to Connects to internet
if connected shows login activity,
else
gives message "Internet connection not found"
neither is happening, it is neither moving to login activity nor showing msg
means job is failing. I have no clue why the job is failing.
Same apk is working on other mobiles.
Juzer
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Well, I dont know how complete your code is in your above post, but, the btnlogin subroutine wont do anything if the file already exists.

B4X:
Sub btnLogin_Click
    Dim ServerURL As String=""
    ServerURL="http://xxx.com/yyy.aspx"
 
    If File.Exists(File.DirInternal&"/xyz/Database", "xyz.db") = False  Then
            job1.Initialize("Job1",Me)
            job1.Download2(ServerURL,Array As String("Cmpycode","100"))
            Return
    End if
    'If file does exist, Now what? According to this, nothing will happen!

End Sub

Your checking for a file, and only doing something if that file is not found.

What if its found? What if its there? According to your code above, it will do absolutely nothing.

Also on newer versions of android, if your using HTTP instead of HTTPS, you have to add something to the manifest to tell the system you are using unencrypted sessions still, with no SSL.

Also when your job1.jobdone fires, Log the Success flag. See if it is true, or if it is false.

B4X:
Sub Jobdone(Job As HttpJob)
If Job.Success =True Then
Select Job.JobName
    Case "Job1"
    If job1.GetString.Contains("Names") Then
        job1.Release 
        StartActivity("frmLogin") 
    Else 
        bFlagInternetConnection=False
        ToastMessageShow("Internet Connection Not Found",bFlagInternetConnection)
    End If
End Select
End If
'You are missing your Job.Success = False clause. Again, if you end up here, your app wont do anything. You need to find out why Success = False if this is the case. 

End Sub

If it is false, you need to determine why. you may be able to log the Exception to see why.
 
Last edited:
Upvote 0

Juzer Hussain

Active Member
Licensed User
Longtime User
Teknight,
1. This is happening right after app installation.Its sure DB file is not there.
2. Apk is working in other mobiles.

I have inserted msgs for job failed i am waiting for reply from client.
If the job is failing what to do i dont have any clue.
This is not a code related problem. It is related to OS.
Juzer
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
Sometimes it happens that we look at the code and do not see obvious mistakes, often mundane and absurd.
I'm sorry about that question.
Did you clear the project (ctrl+P) before the final compilation?
 
Upvote 0
Top