Alansari Member Licensed User Longtime User Dec 12, 2018 #1 Hi Freinds After i updated SDK to platform 28 the App can't access DirAssets files Code: pdfname = "vb2010.pdf" File.Copy(File.DirAssets,pdfname,File.DirDefaultExternal,pdfname) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) What is the solution ? look the images if there any problems
Hi Freinds After i updated SDK to platform 28 the App can't access DirAssets files Code: pdfname = "vb2010.pdf" File.Copy(File.DirAssets,pdfname,File.DirDefaultExternal,pdfname) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) What is the solution ? look the images if there any problems
DonManfred Expert Licensed User Longtime User Dec 12, 2018 #2 DirAssets is readonly. You can not write here. where is the code which raises the error? Upvote 0
Alansari Member Licensed User Longtime User Dec 12, 2018 #3 DonManfred said: DirAssets is readonly. You can not write here. where is the code which raises the error? Click to expand... Code: pdfname = "vb2010.pdf" File.Copy(File.DirAssets,pdfname,File.DirDefaultExternal,pdfname) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) whan i start the app can't read the files from DirAssets Upvote 0
DonManfred said: DirAssets is readonly. You can not write here. where is the code which raises the error? Click to expand... Code: pdfname = "vb2010.pdf" File.Copy(File.DirAssets,pdfname,File.DirDefaultExternal,pdfname) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) whan i start the app can't read the files from DirAssets
DonManfred Expert Licensed User Longtime User Dec 12, 2018 #4 looks like the file is not there. Is it listed in the files tab in the IDE? Upvote 0
Alansari Member Licensed User Longtime User Dec 12, 2018 #5 Alansari said: Code: pdfname = "vb2010.pdf" File.Copy(File.DirAssets,pdfname,File.DirDefaultExternal,pdfname) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) whan i start the app can't read the files from DirAssets Click to expand... DonManfred said: looks like the file is not there. Is it listed in the files tab in the IDE? Click to expand... Upvote 0
Alansari said: Code: pdfname = "vb2010.pdf" File.Copy(File.DirAssets,pdfname,File.DirDefaultExternal,pdfname) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) whan i start the app can't read the files from DirAssets Click to expand... DonManfred said: looks like the file is not there. Is it listed in the files tab in the IDE? Click to expand...
Erel B4X founder Staff member Licensed User Longtime User Dec 12, 2018 #6 Please don't post all these screenshots. Post code and errors as text. You should never use File.DirDefaultExternal. Watch the runtime permissions video tutorial. Upvote 0
Please don't post all these screenshots. Post code and errors as text. You should never use File.DirDefaultExternal. Watch the runtime permissions video tutorial.
M Mahares Expert Licensed User Longtime User Dec 12, 2018 #7 Alansari said: What is the solution ? Click to expand... You should use runtime permissions and your code should include something like this: Code: Dim rp As RuntimePermissions 'need runtime permissions library. This line should preferably in Starter service File.Copy(File.DirAssets,pdfname,rp.GetSafeDirDefaultExternal(""),pdfname) Also: Your target SDK in your manifest should be: 26 not 28 Syd Wright said: Maybe you have used capital letters in your actual file name? Click to expand... It does not matter anymore. The file names are internally converted to lower case. So, it is not a problem if the asset files are in uppercase. Upvote 0
Alansari said: What is the solution ? Click to expand... You should use runtime permissions and your code should include something like this: Code: Dim rp As RuntimePermissions 'need runtime permissions library. This line should preferably in Starter service File.Copy(File.DirAssets,pdfname,rp.GetSafeDirDefaultExternal(""),pdfname) Also: Your target SDK in your manifest should be: 26 not 28 Syd Wright said: Maybe you have used capital letters in your actual file name? Click to expand... It does not matter anymore. The file names are internally converted to lower case. So, it is not a problem if the asset files are in uppercase.
Alansari Member Licensed User Longtime User Dec 13, 2018 #8 Mahares said: You should use runtime permissions and your code should include something like this: Code: Dim rp As RuntimePermissions 'need runtime permissions library. This line should preferably in Starter service File.Copy(File.DirAssets,pdfname,rp.GetSafeDirDefaultExternal(""),pdfname) Also: Your target SDK in your manifest should be: 26 not 28 It does not matter anymore. The file names are internally converted to lower case. So, it is not a problem if the asset files are in uppercase. Click to expand... I will test this Thanks for replay . I will test this code can you give me this Library :runtime permissions library ? Upvote 0
Mahares said: You should use runtime permissions and your code should include something like this: Code: Dim rp As RuntimePermissions 'need runtime permissions library. This line should preferably in Starter service File.Copy(File.DirAssets,pdfname,rp.GetSafeDirDefaultExternal(""),pdfname) Also: Your target SDK in your manifest should be: 26 not 28 It does not matter anymore. The file names are internally converted to lower case. So, it is not a problem if the asset files are in uppercase. Click to expand... I will test this Thanks for replay . I will test this code can you give me this Library :runtime permissions library ?
DonManfred Expert Licensed User Longtime User Dec 13, 2018 #9 the forum search is working. Just search for it Upvote 0
Alansari Member Licensed User Longtime User Dec 13, 2018 #10 DonManfred said: the forum search is working. Just search for it Click to expand... Thanks Upvote 0
Alansari Member Licensed User Longtime User Dec 13, 2018 #11 I did not know to do that if this file in DirAssets : index.txt how to access it ? please write to me the full code Upvote 0
I did not know to do that if this file in DirAssets : index.txt how to access it ? please write to me the full code
Computersmith64 Well-Known Member Licensed User Longtime User Dec 13, 2018 #12 Alansari said: I did not know to do that if this file in DirAssets : index.txt how to access it ? please write to me the full code Click to expand... The runtime permissions tutorial (https://www.b4x.com/android/forum/threads/runtime-permissions-android-6-0-permissions.67689/#content) provides all the information you need to be able to write the code yourself. If there are other things that aren't clear to you, then search the forum for the specific issue you are having & if you still can't figure it out then ask - but don't expect other forum members to write the code for you. You won't learn anything if you just copy & past code that others have written. - Colin. Upvote 0
Alansari said: I did not know to do that if this file in DirAssets : index.txt how to access it ? please write to me the full code Click to expand... The runtime permissions tutorial (https://www.b4x.com/android/forum/threads/runtime-permissions-android-6-0-permissions.67689/#content) provides all the information you need to be able to write the code yourself. If there are other things that aren't clear to you, then search the forum for the specific issue you are having & if you still can't figure it out then ask - but don't expect other forum members to write the code for you. You won't learn anything if you just copy & past code that others have written. - Colin.
Alansari Member Licensed User Longtime User Dec 14, 2018 #13 Computersmith64 said: The runtime permissions tutorial (https://www.b4x.com/android/forum/threads/runtime-permissions-android-6-0-permissions.67689/#content) provides all the information you need to be able to write the code yourself. If there are other things that aren't clear to you, then search the forum for the specific issue you are having & if you still can't figure it out then ask - but don't expect other forum members to write the code for you. You won't learn anything if you just copy & past code that others have written. - Colin. Click to expand... Thanks a lot I did not find link of library download Upvote 0
Computersmith64 said: The runtime permissions tutorial (https://www.b4x.com/android/forum/threads/runtime-permissions-android-6-0-permissions.67689/#content) provides all the information you need to be able to write the code yourself. If there are other things that aren't clear to you, then search the forum for the specific issue you are having & if you still can't figure it out then ask - but don't expect other forum members to write the code for you. You won't learn anything if you just copy & past code that others have written. - Colin. Click to expand... Thanks a lot I did not find link of library download
Computersmith64 Well-Known Member Licensed User Longtime User Dec 14, 2018 #14 Alansari said: Thanks a lot I did not find link of library download Click to expand... Which library? Runtime Permissions? I think it's a core library, so look for it in the Libraries tab in the B4A IDE. - Colin. Upvote 0
Alansari said: Thanks a lot I did not find link of library download Click to expand... Which library? Runtime Permissions? I think it's a core library, so look for it in the Libraries tab in the B4A IDE. - Colin.
Alansari Member Licensed User Longtime User Dec 14, 2018 #15 Computersmith64 said: Which library? Runtime Permissions? I think it's a core library, so look for it in the Libraries tab in the B4A IDE. View attachment 75297 - Colin. Click to expand... Thanks. i find it ^_^ Upvote 0
Computersmith64 said: Which library? Runtime Permissions? I think it's a core library, so look for it in the Libraries tab in the B4A IDE. View attachment 75297 - Colin. Click to expand... Thanks. i find it ^_^
I IdasI4A Active Member Licensed User Longtime User Dec 14, 2018 #17 Test with Code: If File.Exists(rp.GetSafeDirDefaultExternal(""),"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",rp.GetSafeDirDefaultExternal(""),"fav.db") End If or better yet Code: dim Carpeta as String Carpeta=rp.GetSafeDirDefaultExternal("") If File.Exists(Carpeta,"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",Carpeta,"fav.db") End If Upvote 0
Test with Code: If File.Exists(rp.GetSafeDirDefaultExternal(""),"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",rp.GetSafeDirDefaultExternal(""),"fav.db") End If or better yet Code: dim Carpeta as String Carpeta=rp.GetSafeDirDefaultExternal("") If File.Exists(Carpeta,"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",Carpeta,"fav.db") End If
Alansari Member Licensed User Longtime User Dec 14, 2018 #18 IdasI4A said: Test with Code: If File.Exists(rp.GetSafeDirDefaultExternal(""),"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",rp.GetSafeDirDefaultExternal(""),"fav.db") End If or better yet Code: dim Carpeta as String Carpeta=rp.GetSafeDirDefaultExternal("") If File.Exists(Carpeta,"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",Carpeta,"fav.db") End If Click to expand... Waw Thats work Thanks a lot ms.ldasl4A look at this code .. not work please edit it Code: File.Copy(File.DirAssets,aaa.pdf,File.DirDefaultExternal,aaa.pdf) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,aaa.pdf),1,True,True) Last edited: Dec 14, 2018 Upvote 0
IdasI4A said: Test with Code: If File.Exists(rp.GetSafeDirDefaultExternal(""),"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",rp.GetSafeDirDefaultExternal(""),"fav.db") End If or better yet Code: dim Carpeta as String Carpeta=rp.GetSafeDirDefaultExternal("") If File.Exists(Carpeta,"fav.db") = False Then File.Copy(File.DirAssets,"fav.db",Carpeta,"fav.db") End If Click to expand... Waw Thats work Thanks a lot ms.ldasl4A look at this code .. not work please edit it Code: File.Copy(File.DirAssets,aaa.pdf,File.DirDefaultExternal,aaa.pdf) pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,aaa.pdf),1,True,True)
Alansari Member Licensed User Longtime User Dec 14, 2018 #19 this code work : Code: If File.Exists(rp.GetSafeDirDefaultExternal(""),pdfname) = False Then File.Copy(File.DirAssets,pdfname,rp.GetSafeDirDefaultExternal(""),pdfname) but last line not work: Code: pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) How to correct ??? Upvote 0
this code work : Code: If File.Exists(rp.GetSafeDirDefaultExternal(""),pdfname) = False Then File.Copy(File.DirAssets,pdfname,rp.GetSafeDirDefaultExternal(""),pdfname) but last line not work: Code: pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) How to correct ???
Computersmith64 Well-Known Member Licensed User Longtime User Dec 14, 2018 #20 Alansari said: this code work : but last line not work: Code: pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) How to correct ??? Click to expand... What is pdf? Post your declaration for the pdf object. - Colin. Upvote 0
Alansari said: this code work : but last line not work: Code: pdf.Initialize("PDFView",File.Combine(File.DirDefaultExternal,pdfname),1,True,True) How to correct ??? Click to expand... What is pdf? Post your declaration for the pdf object. - Colin.