Android Question inport database from internal memory storage to internal directory

fifiddu70

Well-Known Member
Licensed User
Longtime User
hello, i have a problem with my program,
i need to inport file db in internal directory of the app
i usa this code:


inportb database:
Sub btnimportadb_Click
    
    Dim Selection As Short
    Selection = Msgbox2("Sei sicuro di voler eliminare il database esistente e di volerlo sostituire con un'altro? se premi si elimini il database esistente".ToUpperCase, "A T T E N Z I O N E !!", "Si", "", "No", Null)
    Select Selection
        Case DialogResponse.POSITIVE
    mp1.Load(File.DirAssets,"eseguito.mp3")
    mp1.Play
    'rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        mp1.Load(File.DirAssets,"eseguito.mp3")
        mp1.Play
        'File.Delete(File.DirInternal,"comande.db")
        File.Copy(File.DirDefaultExternal, "comande.db", File.DirInternal, "comande.db")
        MsgboxAsync("Importazione del database effettuata correttamente, riavviare l'applicazione.","DATABASE IMPORTATO")
        
    Else
        Log("no permission")
    End If
        Case DialogResponse.CANCEL, DialogResponse.NEGATIVE
    End Select
    'mp1.Load(File.DirAssets,"txmessaggio.mp3")
    'mp1.Play
    'File.Delete(File.DirInternal,"comande.db")
    'File.Copy(File.DirRootExternal, "comande.db", File.DirInternal, "comande.db")
    'MsgboxAsync("Importazione del database effettuata correttamente, riavviare l'applicazione.","DATABASE IMPORTATO")
End Sub

the app exit
in logs i read this:java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.partannasoftware.takeaway10Asporto/files/comande.db: open failed: ENOENT (No such file or directory)
 

Star-Dust

Expert
Licensed User
Longtime User
what version of android
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Absolutely correct.
I ran into the same problem, tryin' to move a downloaded file from the general download folder to the working folder of my app. Works with APK29, but not with APK30 thanks to newly introduced and very helpful "security restrictions". Another nice and absolutely useless ANDROID-addition. Unfortunally we have to live with it, finding again and again workarounds. GOOGLE makes the rules, but it is becoming more worse with every new rollout of a new ANDROID-version for developers.
 
Upvote 0
Top