On some android devices, like the Samsung Galaxy S9, if you don't explicitly call commit, shared prefs will not be updated and it will be like you never deleted the key.
You may also want add @SuppressLint("ApplySharedPref") to the method since android studio complains about using commit() over apply(). But in this case, I would think that commit (which synchronously) is the correct behaviour.
On some android devices, like the Samsung Galaxy S9, if you don't explicitly call commit, shared prefs will not be updated and it will be like you never deleted the key.
You may also want add
@SuppressLint("ApplySharedPref")
to the method since android studio complains about using commit() over apply(). But in this case, I would think that commit (which synchronously) is the correct behaviour.