Status Update
Comments
yu...@gmail.com <yu...@gmail.com> #2
My dependencies:
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.gms:play-services-wearable:17.1.0'
implementation 'com.google.android.material:material:1.4.0'
If I remove androidx.appcompat:appcompat:1.4.0
, the warning vanishes, so I imagine there's some transitive dependency on an older version of androidx.appcompat:appcompat
that doesn't have the warning.
yu...@gmail.com <yu...@gmail.com> #4
The upstream library is using @SuppressWarnings("deprecation")
, which I suppose you could probably use to suppress the warning you're getting.
As for doing fully the non-deprecated way, it is possible that would require overwriting/duplicating more functionality than you currently are and/or updates to the Preference library.
However, I suspect that FragmentManager is capable of handling Fragment subclasses. You should probably look for instructions on developer.android.com, stackoverflow, or similar.
yu...@gmail.com <yu...@gmail.com> #5
Looks like a duplicate of
zh...@google.com <zh...@google.com> #6
Hi, thanks for the question, could you please provide some more details about how you called the DataStore#updateData
and DataStore.data
?
yu...@gmail.com <yu...@gmail.com> #7
For example, when I use a SwitchButton to switch state, I use
settingsDataStore.setImperial(state)
And received the data changes of settingsDataStore through Flow, and the imperial was modified. Then I directly powered off the device, and the imperial state was not saved after restarting.
yu...@gmail.com <yu...@gmail.com> #8
si...@avocodo.com <si...@avocodo.com> #9
Change the setting, take the power away and after boot there is not only the testDataStore.preferences_pb file on the filesystem but also but also a testDataStore.preferences_pb.tmp there.
If I do a "good" reboot with adb reboot or shut down the device without disconnecting the power supply (no battery device) after changing the data in the datastore I don't see this .tmp file here and the data in the datastore is correct.
Comment 4
yu...@gmail.com <yu...@gmail.com> #10
#9 Hello, I have been looking for a solution to this problem and have made a breakthrough today. You can see my latest news at
Description
I found that restarting the APP can make changes and saves normally, but the above problem will occur when the device is powered off and restarted.