Android Question My app crashes

Baris Karadeniz

Active Member
Licensed User
My app crashes after working some time. I couldn't find why it crashes. Is there anyone who can help me? I can send my app.
 

KMatle

Expert
Licensed User
Longtime User
Is there anyone who can help me? I can send my app.

Hi Baris. We are not able to test your app for hours ('till the app crashes). It's abolutely necessary that you learn how to debug your apps. Of course we help with errors you can't fix on your own

For sure there is a log when it crashes. So please check it first (uncheck filtered logs) and see. Run it in debug or get the logs in Release by setting

B4X:
#BridgeLogger: True

(Update the B4A Bridge to the newest version)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
It sounds like a memory issue.
What is it for an app?

If u put this line to the manifest it may solve your problem

B4X:
SetApplicationAttribute(android:largeHeap,"true")

BUT this is not the right way to solve the problem you should find the reason why your app consume a lot of memory and try to fix it.
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Where should I write #BridgeLogger: True ?

Where you want but is good practise put this in first line module Main of course:

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region


#BridgeLogger: True

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub
 
Upvote 0

Baris Karadeniz

Active Member
Licensed User
My app is for gps. It sends information to the server. It uses camera and webwiew. My app is given attached.
 

Attachments

  • TaksimDriver26B4A.zip
    27.4 KB · Views: 191
Upvote 0

Baris Karadeniz

Active Member
Licensed User
Here is the log. I think crash occurs at; ** Service (starter) Create **



** Service (starter) Start **
** Service (starter) Start **
 

Attachments

  • TaksimDriver26B4A.zip
    27.4 KB · Views: 188
Last edited by a moderator:
Upvote 0

Baris Karadeniz

Active Member
Licensed User
Yes I start starter. You can see the codes below;

B4X:
Sub BtnSystemOnOff_CheckedChange(Checked As Boolean)
    If TextFieldimei.Text.Length = 15 Then
        If Starter.GPS1.GPSEnabled = True Then
            If BtnSystemOnOff.Checked = True Then   
                BtnSystemOnOff.Color = Colors.Green
                systemon = True
                StartService(Starter)
                Event = ""
            Else
                BtnSystemOnOff.Color = Colors.Red
                systemon = False
                StopService(Starter)           
            End If
        Else
            Msgbox(lblgpstextdisable, warningtitle1)
        End If
    Else
        Msgbox(warning1, warningtitle1)
    End If
End Sub
 
Upvote 0

Baris Karadeniz

Active Member
Licensed User
I added new service module named as "Starter2". I wrote the code below (StartServiceAt ....) into Starter2;

B4X:
#Region  Service Attributes
    #StartAtBoot: False
   
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)
    StartServiceAt(Starter, DateTime.Now + 6 * DateTime.TicksPerSecond, True)
End Sub

Sub Service_Destroy

End Sub

To start the "Starter2" I wrote the code below into the Main;

B4X:
ub BtnSystemOnOff_CheckedChange(Checked As Boolean)
    If TextFieldimei.Text.Length = 15 Then
        If Starter.GPS1.GPSEnabled = True Then
            If BtnSystemOnOff.Checked = True Then   
                BtnSystemOnOff.Color = Colors.Green
                systemon = True
                StartService(Starter2)
                Event = ""
            Else
                BtnSystemOnOff.Color = Colors.Red
                systemon = False
                StopService(Starter2)           
            End If
        Else
            Msgbox(lblgpstextdisable, warningtitle1)
        End If
    Else
        Msgbox(warning1, warningtitle1)
    End If
End Sub

But it doesn't work.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…