Io ho questo codice:
quando lo lancio trovo questo errore:
Error occurred on line: 312 (CicloAttuale)
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/b4a.aldopanizzi.mobi/files/db/0987.db exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:2141)
at android.net.Uri.checkFileUriExposed(Uri.java:2391)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:967)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11812)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11797)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1722)
at android.app.Activity.startActivityForResult(Activity.java:5377)
at android.app.Activity.startActivityForResult(Activity.java:5335)
at android.app.Activity.startActivity(Activity.java:5721)
at android.app.Activity.startActivity(Activity.java:5674)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857)
at b4a.aldopanizzi.mobi.cicloattuale._button1_click(cicloattuale.java:1222)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
Cosa sbaglio?
Credo sia un problema di permessi. Come posso rimediare?
Grazie
B4X:
Dim Mail As String
Dim CodUtente As String
SQL1.Initialize(DBDirName, DBFileName, True)
ResultSet1 = SQL1.ExecQuery("SELECT * FROM Impostazioni")
Do While ResultSet1.NextRow
CodUtente = ResultSet1.GetString("codice_utente")
Mail = ResultSet1.GetString("mail_insegnante")
Loop
SQL1.Close
Dim nomefile As String = CodUtente & ".db"
Dim nuovadir As String = rp.GetSafeDirDefaultExternal("db")
File.Copy(DBDirName, DBFileName, nuovadir, nomefile)
Dim email As Email
Dim subject As String = "Invio file: " & nomefile
email.To.Add(Mail)
email.Subject = subject
email.Body = "Invio automatico del file db utente: " & CodUtente
email.Attachments.Add(File.Combine(nuovadir, nomefile))
StartActivity(email.GetIntent)
quando lo lancio trovo questo errore:
Error occurred on line: 312 (CicloAttuale)
android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/b4a.aldopanizzi.mobi/files/db/0987.db exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:2141)
at android.net.Uri.checkFileUriExposed(Uri.java:2391)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:967)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11812)
at android.content.Intent.prepareToLeaveProcess(Intent.java:11797)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1722)
at android.app.Activity.startActivityForResult(Activity.java:5377)
at android.app.Activity.startActivityForResult(Activity.java:5335)
at android.app.Activity.startActivity(Activity.java:5721)
at android.app.Activity.startActivity(Activity.java:5674)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:857)
at b4a.aldopanizzi.mobi.cicloattuale._button1_click(cicloattuale.java:1222)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:8160)
Cosa sbaglio?
Credo sia un problema di permessi. Come posso rimediare?
Grazie