G GeoffT660 Active Member Licensed User Longtime User Apr 20, 2024 #1 I am troubleshooting a new REVVL Tab 5g running Android SDK 34. Data in the SqlCipher database loses all data in the database upon closing the application. I can see it populates the database when downloading the data but when I exit the app, none of the data is saved. This works on every version without issue prior to SDK 34. I tried updating to SqlCipher 1.7 but still have the same issue. All the database transactions work as expected while in the app and only when you close the app completely all the data is removed from the database. Any ideas on how I can resolve this issue. Thanks.
I am troubleshooting a new REVVL Tab 5g running Android SDK 34. Data in the SqlCipher database loses all data in the database upon closing the application. I can see it populates the database when downloading the data but when I exit the app, none of the data is saved. This works on every version without issue prior to SDK 34. I tried updating to SqlCipher 1.7 but still have the same issue. All the database transactions work as expected while in the app and only when you close the app completely all the data is removed from the database. Any ideas on how I can resolve this issue. Thanks.
B Brian Dean Well-Known Member Licensed User Longtime User Apr 20, 2024 #2 This sounds very much like a permissions error. You say that your targetSdkVersion in the Tab 5g is 34. What was the targetSdkVersion previously? When you say "none of the data is saved" - where are you trying to save this data? Last edited: Apr 20, 2024 Upvote 0
This sounds very much like a permissions error. You say that your targetSdkVersion in the Tab 5g is 34. What was the targetSdkVersion previously? When you say "none of the data is saved" - where are you trying to save this data?
G GeoffT660 Active Member Licensed User Longtime User Apr 20, 2024 #3 Previously my targetSdkVersion was 33. My app has worked for over 10 years without issue on every device I found so far. I download data and populate the tables in the sqlCipher database where the data is stored. Everything works great and I can perform any sql transaction on the data in the tables as I always have as long as I stay in the App. When I exit the app, all the data in the SqlCipher Db is gone. I can confirm this with dbBrowser. Never seen anything like this. The only difference that I can see is the new Android Version 34 because the app still works fine on all other devices including 33. Upvote 0
Previously my targetSdkVersion was 33. My app has worked for over 10 years without issue on every device I found so far. I download data and populate the tables in the sqlCipher database where the data is stored. Everything works great and I can perform any sql transaction on the data in the tables as I always have as long as I stay in the App. When I exit the app, all the data in the SqlCipher Db is gone. I can confirm this with dbBrowser. Never seen anything like this. The only difference that I can see is the new Android Version 34 because the app still works fine on all other devices including 33.
G GeoffT660 Active Member Licensed User Longtime User Apr 20, 2024 #4 I have found a solution but don't understand all the intricacies so not sure why the change. I have always used B4X: Dim DBFileDir = File.DirDefaultExternal As String to define my device db directory. On sdk version 34 I now have to use B4X: Dim DBFileDir = File.DirInternal As String but this doesn't work on previous versions so I have added this code B4X: If phone.SdkVersion > 33 Then Dim DBFileDir = File.DirInternal As String Else Dim DBFileDir = File.DirDefaultExternal As String End If Could this issue be device specific or the change in the TargetSdkVersion? Please let me know if I should be using a different method or you see any issues with this approach. Upvote 0
I have found a solution but don't understand all the intricacies so not sure why the change. I have always used B4X: Dim DBFileDir = File.DirDefaultExternal As String to define my device db directory. On sdk version 34 I now have to use B4X: Dim DBFileDir = File.DirInternal As String but this doesn't work on previous versions so I have added this code B4X: If phone.SdkVersion > 33 Then Dim DBFileDir = File.DirInternal As String Else Dim DBFileDir = File.DirDefaultExternal As String End If Could this issue be device specific or the change in the TargetSdkVersion? Please let me know if I should be using a different method or you see any issues with this approach.
B Brian Dean Well-Known Member Licensed User Longtime User Apr 20, 2024 #5 This was the reason for my other question, which you did not answer before . . . When you say "none of the data is saved" - where are you trying to save this data? Click to expand... Your answer is . . . B4X: Dim DBFileDir = File.DirDefaultExternal As String Sdk 34 does not allow writing directly to storage outside of the app local storage without asking the User to select a location. See this thread. Using internal storage on earlier Sdks should not be a problem, however, so your code modification should not be required. I don't know what is happening there. Upvote 0
This was the reason for my other question, which you did not answer before . . . When you say "none of the data is saved" - where are you trying to save this data? Click to expand... Your answer is . . . B4X: Dim DBFileDir = File.DirDefaultExternal As String Sdk 34 does not allow writing directly to storage outside of the app local storage without asking the User to select a location. See this thread. Using internal storage on earlier Sdks should not be a problem, however, so your code modification should not be required. I don't know what is happening there.
peacemaker Expert Licensed User Longtime User Apr 20, 2024 #6 B4X: Dim DBFileDir = File.DirDefaultExternal As String or B4X: Dim DBFileDir As String = File.DirDefaultExternal ? Upvote 0
B4X: Dim DBFileDir = File.DirDefaultExternal As String or B4X: Dim DBFileDir As String = File.DirDefaultExternal ?
A Alex_197 Well-Known Member Licensed User Longtime User Apr 20, 2024 #7 Use B4X: dim rp As RuntimePermissions FileDir=rp.GetSafeDirDefaultExternal("") Upvote 0
G GeoffT660 Active Member Licensed User Longtime User Apr 20, 2024 #8 You are right B4X: Dim DBFileDir As String = File.DirDefaultExternal is the correct syntax. Not sure why it never gave a warning and has always worked this way. Thanks. Upvote 0
You are right B4X: Dim DBFileDir As String = File.DirDefaultExternal is the correct syntax. Not sure why it never gave a warning and has always worked this way. Thanks.
G GeoffT660 Active Member Licensed User Longtime User Apr 20, 2024 #9 B4X: FileDir=rp.GetSafeDirDefaultExternal("") does not help with the original issue on TargetSdkVersion 34 but works fine on 33 and below. Upvote 0
B4X: FileDir=rp.GetSafeDirDefaultExternal("") does not help with the original issue on TargetSdkVersion 34 but works fine on 33 and below.
OliverA Expert Licensed User Longtime User Apr 20, 2024 #10 GeoffT660 said: TargetSdkVersion 34 but works fine on 33 and below. Click to expand... I'm pretty sure the current recommended targetSDKVersion for B4A 33. I could be mistaken and any corrections on this are welcome. Upvote 1
GeoffT660 said: TargetSdkVersion 34 but works fine on 33 and below. Click to expand... I'm pretty sure the current recommended targetSDKVersion for B4A 33. I could be mistaken and any corrections on this are welcome.