The app can be started by clicking it's icon but most of the time the app starts at boot with a sticky service.
I can post the logs but they are "home-made" so they don't give you any useful information, for example:
.....
.....
Routine Restart started
UsersA Found: 0
Average Users: 0
UsersB found: 36
Distance: 7.4305901527404785
Restart in 4 minutes
Database not initialized?!?!?!
16:56:33
status: 1
.....
.....
I dont know how to close a database, so i think i am not closing it intentionally.
I have to say that the code i posted in the first post is just part of an another If-THEN:
If StartingIntent.IsInitialized And StartingIntent.Action = "android.net.conn.CONNECTIVITY_CHANGE" Then
If (Starter.Database.IsInitialized == True) Then
.....<My codes here>.....
Else
logger.Initialize(File.OpenOutput(File.DirDefaultExternal, "Logger.txt", True))
logger.WriteLine("Database not initialized?!?!?!")
logger.Close
End If
Else
....
End If
So, is it possible that the broadcast receiver works even if the starter service not completed the initialization?
Anyway the problems doesn't occour so often but it happens.
Sometimes when i use codes like the following for getting username and password from database and i post it to server, the server says me that i sent empty/null values even if username and password are there stored in database:
Riautenticazione.PostString(Starter.IndirizzoServer & Starter.VersioneApp & "/Riauth.php", "user=" & Funzioni.ImpostazioniGET("user") & "&password=" & Funzioni.ImpostazioniGET("pass"))
where ImpostazioniGET is:
Sub ImpostazioniGET(NomeImpostazione As String) As String
Dim ValoreDaRestituire As String
Dim CursoreImpostazioni As Cursor
Try
CursoreImpostazioni = Starter.DatabaseImpostazioni.ExecQuery2("SELECT [" & NomeImpostazione & "] FROM impostazioni WHERE user = ?", Array As String(Starter.Username))
Catch
Starter.DatabaseImpostazioni.ExecNonQuery("ALTER TABLE impostazioni ADD COLUMN [" & NomeImpostazione & "] TEXT")
Starter.DatabaseImpostazioni.Initialize(File.DirDefaultExternal, "settings.db", True)
ValoreDaRestituire = Null
Return ValoreDaRestituire
End Try
If CursoreImpostazioni.RowCount > 0 Then
CursoreImpostazioni.Position = 0
ValoreDaRestituire = CursoreImpostazioni.GetString(NomeImpostazione)
Else
ValoreDaRestituire = Null
End If
CursoreImpostazioni.Close
Return ValoreDaRestituire
End Sub