Nevertheless, we did notice some hiccups on a handful of devices. Especially, OnePlus phones. OnePlus has this weird battery optimisation strategy where it pretty much cancels every background activity to save your battery.
ViewModels only survive configuration change-related destruction; they do not survive the process being stopped. This makes ViewModels a replacement for using a fragment with
setRetainInstance(true) (in fact ViewModels use a fragment with setRetainInstance set to true behind the scenes).
…which means handling and safeguarding many secret API keys. Secrets are supposed to be kept secret. Unfortunately, for a secret held on a mobile app, it’s not a question of if it will be stolen but when it will be stolen and with how much effort.
Most of the time when you pass a
boolean into a function, you are loudly declaring to the world that you’ve written a function that does two things. One thing for the
true case and another for the
false case. Instead, you should have written two functions, one for each case.