1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Error Code : 1294 (SQLITE_CANTOPEN_ENOENT)

Discussion in 'Android Questions' started by PierPaduan, Apr 8, 2019.

  1. PierPaduan

    PierPaduan Active Member Licensed User

    Hi everyone.

    I have my app on Google Play.
    Crashlytics reported me the following error from one user.

    It happened five times on a single device:
    Brand: samsung
    Model: SM-N950U
    Android version: 8.0.0

    For development I use a Galaxy Samsung S7 Edge with Android 8.0.0 and it works correctly.
    I've tried on the S7 to uninstall and install again from Google Play and all works correctly.

    I don't know how to fix this problem. Someone can help me?
    Thanks a Lot to everyone.

    My Starter code is the following:
    Code:
    #Region  Service Attributes
        
    #StartAtBoot: False
    #End Region

    Sub Process_Globals
        
    Public sql As SQL
        
        
    Public rp As RuntimePermissions
        
    Public SafeDirDefExt As String
        
        
    Public Provider As FileProvider

        
    Public CL As Crashlytics        'Per crashlytics
        
    End Sub

    Sub Service_Create
        
        SafeDirDefExt = rp.GetSafeDirDefaultExternal(
    "")
        
       
        
        
    'if doesn't exist I create the directory
        If File.Exists(SafeDirDefExt, "/SETandGO/Data") = False Then
            
    File.MakeDir(SafeDirDefExt, "/SETandGO/Data")
        
    End If

        
    If File.Exists(SafeDirDefExt & "/SETandGO/Data""ReportsButtWeld_v1.db"Then
            
    'open database
            sql.Initialize(SafeDirDefExt & "/SETandGO/Data""ReportsButtWeld_v1.db"True)
            
        
    Else
            
    'create and open database
            sql.Initialize(SafeDirDefExt & "/SETandGO/Data""ReportsButtWeld_v1.db"True)
           
            
            DBUtils.CreateTable(
    sql"reports",  _
            CreateMap(
    "id": DBUtils.DB_INTEGER, _
            
    "mo_modello_macchina": DBUtils.DB_TEXT, _
            
    "pa_tepa": DBUtils.DB_TEXT, _
            
    "di_diametro": DBUtils.DB_TEXT, _
            
    "sd_sdr": DBUtils.DB_TEXT, _
            
    "en_spessore": DBUtils.DB_TEXT, _
            
    "ma_materiale": DBUtils.DB_TEXT, _
            
    "st_norma": DBUtils.DB_TEXT, _
            
    "pi_press_interf": DBUtils.DB_TEXT, _
            
    "pt_drag": DBUtils.DB_TEXT, _
            
    "CL_tpmin": DBUtils.DB_TEXT, _
            
    "CN_tpnom": DBUtils.DB_TEXT, _
            
    "CH_tpmax": DBUtils.DB_TEXT, _
            
    "Ab_dim_bord": DBUtils.DB_TEXT, _
            
    "p1_pbord": DBUtils.DB_TEXT, _
            
    "p2_prisc": DBUtils.DB_TEXT, _
            
    "p3_psald": DBUtils.DB_TEXT, _
            
    "p4_pdual": DBUtils.DB_TEXT, _
            
    "t1_tbord": DBUtils.DB_TEXT, _
            
    "t2_trisc": DBUtils.DB_TEXT, _
            
    "t3_tscambio": DBUtils.DB_TEXT, _
            
    "t4_trampa": DBUtils.DB_TEXT, _
            
    "t5_tsald": DBUtils.DB_TEXT, _
            
    "t6_tdual": DBUtils.DB_TEXT, _
            
    "t7_traffr": DBUtils.DB_TEXT, _
            
    "bo_badge": DBUtils.DB_TEXT, _
            
    "tp_traccia1": DBUtils.DB_TEXT, _
            
    "ts_traccia2": DBUtils.DB_TEXT, _
            
    "la_gpslat": DBUtils.DB_TEXT, _
            
    "lo_gpslon": DBUtils.DB_TEXT, _
            
    "sn_matricola": DBUtils.DB_TEXT, _        'matricola della saldatrice richiesta e ricevuta ad inizio comunicazione tra app e saldatrice.
            "ns_numsald": DBUtils.DB_TEXT, _        'numero della saldatura ricevuta ad inizio comunicazione +1, deve essere uguale al numero "ns_numsald_rx" che viene ricevuto con il report dalla saldatrice.
            "dd_day_rx": DBUtils.DB_TEXT, _
            
    "mm_month_rx": DBUtils.DB_TEXT, _
            
    "yy_year_rx": DBUtils.DB_TEXT, _
            
    "hh_hour_rx": DBUtils.DB_TEXT, _
            
    "mi_minute_rx": DBUtils.DB_TEXT, _
            
    "CP_temptp_rx": DBUtils.DB_TEXT, _
            
    "CA_tempamb_rx": DBUtils.DB_TEXT, _
            
    "mr_proxrevmese_rx": DBUtils.DB_TEXT, _
            
    "ar_proxrevanno_rx": DBUtils.DB_TEXT, _
            
    "vf_versfirm_rx": DBUtils.DB_TEXT, _
            
    "sn_matricola_rx": DBUtils.DB_TEXT, _    'matricola della saldatrice ricevuta con il report.
            "di_diametro_rx": DBUtils.DB_TEXT, _
            
    "ma_materiale_rx": DBUtils.DB_TEXT, _
            
    "sd_sdr_rx": DBUtils.DB_TEXT, _
            
    "op_operatore_rx": DBUtils.DB_TEXT, _
            
    "lu_luogosald_rx": DBUtils.DB_TEXT, _
            
    "no_note_rx": DBUtils.DB_TEXT, _
            
    "ns_numsald_rx": DBUtils.DB_TEXT, _        'numero della saldatura ricevuto con il report.
            "pt_drag_real_rx": DBUtils.DB_TEXT, _
            
    "p1_pbord_teo_rx": DBUtils.DB_TEXT, _
            
    "p2_prisc_teo_rx": DBUtils.DB_TEXT, _
            
    "p3_psald_teo_rx": DBUtils.DB_TEXT, _
            
    "p4_pdual_teo_rx": DBUtils.DB_TEXT, _
            
    "t1_tbord_teo_rx": DBUtils.DB_TEXT, _
            
    "t2_trisc_teo_rx": DBUtils.DB_TEXT, _
            
    "t3_tscambio_teo_rx": DBUtils.DB_TEXT, _
            
    "t4_trampa_teo_rx": DBUtils.DB_TEXT, _
            
    "t5_tsald_teo_rx": DBUtils.DB_TEXT, _
            
    "t6_tdual_teo_rx": DBUtils.DB_TEXT, _
            
    "t7_traffr_teo_rx": DBUtils.DB_TEXT, _
            
    "TT_tempo_tot_real_rx": DBUtils.DB_TEXT, _
            
    "P1_pbord_real_rx": DBUtils.DB_TEXT, _
            
    "P2_prisc_real_rx": DBUtils.DB_TEXT, _
            
    "P3_psald_real_rx": DBUtils.DB_TEXT, _
            
    "P4_pdual_real_rx": DBUtils.DB_TEXT, _
            
    "T1_tbord_real_rx": DBUtils.DB_TEXT, _
            
    "T2_trisc_real_rx": DBUtils.DB_TEXT, _
            
    "T3_tscambio_real_rx": DBUtils.DB_TEXT, _
            
    "T4_trampa_real_rx": DBUtils.DB_TEXT, _
            
    "T5_tsald_real_rx": DBUtils.DB_TEXT, _
            
    "T6_tdual_real_rx": DBUtils.DB_TEXT, _
            
    "T7_traffr_real_rx": DBUtils.DB_TEXT, _
            
    "es_esito_rx": DBUtils.DB_TEXT, _
            
    "note_app": DBUtils.DB_TEXT, _
            
    "picture_dir": DBUtils.DB_TEXT, _
            
    "picture1": DBUtils.DB_TEXT, _
            
    "picture2": DBUtils.DB_TEXT, _
            
    "punti_fase": DBUtils.DB_TEXT, _            'memorizzo le fasi del ciclo inviate dalla saldatrice durante la saldatura, ognuna seguita da un separatore       
            "punti_tempo": DBUtils.DB_TEXT, _            'memorizzo i tempi inviati dalla saldatrice durante la saldatura, ognuno seguito da un separatore
            "punti_temperatura": DBUtils.DB_TEXT, _        'memorizzo le temperature inviate dalla saldatrice durante la saldatura, ognuna seguita da un separatore
            "punti_pressione": DBUtils.DB_TEXT), _        'memorizzo le pressioni inviate dalla saldatrice durante la saldatura, ognuna seguita da un separatore
            "id")

        
        
    End If
        
        
        Provider.Initialize
        
        
    '*************************************************
        'For crashlytics
        Dim context As JavaObject 'depends on JavaObject
        context.InitializeContext
        CL.Initialize(context)
        
    '*************************************************
        
    End Sub

    Sub Service_Start (StartingIntent As Intent)

    End Sub

    Sub Service_Destroy

    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    File.DirInternal is the safest folder to use.

    There are some cases where the secondary storage will not be available. You can test whether File.ExternalWritable is true or not.

    It is also possible that there is no space left on the device. In that case there is nothing that you can do.
     
  3. PierPaduan

    PierPaduan Active Member Licensed User

    Do you mean to do this way:
    Code:
    'SafeDirDefExt = rp.GetSafeDirDefaultExternal("")
        If File.ExternalWritable Then
            SafeDirDefExt = rp.GetSafeDirDefaultExternal(
    "")
        
    Else
            SafeDirDefExt = 
    File.DirInternal
        
    End If
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Better:
    Code:
    Dir = File.DirInternal
    That is unless you have a special reason to use the secondary storage.
     
    KMatle likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice