So, we need to find a solution to switch to another phone number verification service for phone login. But, we don’t want to switch to other service immediately as users will be affected if new service has some problems we didn’t notice.
We decided to make percentage rollout for new phone number verification services as we need to know whether new verification service is reliable or not.
Code snippets are for Android. But, the concepts may apply to other platforms, too.
Firebase Remote Config let developer change variables inside the app without needing an update.
Firebase A/B Testing helps to make user groups : Facebook Account Kit User and Other Service User ( used FirebaseAuth in this article ) in our case. It also has an option to divide users with percentage so let some percentage of users use Account Kit and other users use other service.
Create an interface PhoneVerifier
And PhoneVerifierResult sealed class as verification result object.
PhoneVerifier is just an abstraction. Concrete implementations can be added based on requirements.
2 implementations in our case : AccountKitPhoneVerifier and FirebaseAuthPhoneVerifier.
Now we created 2 implementations. We still need to consider which implementation will be used for which user.
Firebase Remote Config & A/B Testing
Follow this link to setup Firebase A/B Testing.
This is how we setup.
2 user groups are created. So, value of “android_phone_auth” will be set “accountkit” to 50% of users and “firebase” to other half.
In the app, we need to consider which phone verifier should be used. So, check firebase remote config value if user clicked “Login with Phone”.
PhoneVerifier will be set up based on config value and related Activity will be shown based on it.
Check result at onActivityResult and clear stuffs by calling onDestroy.
And. That’s it. Now, we can wait and figure out whether new service works well for users and can switch to another service if it doesn’t work.
An abstraction + Remote Config + A/B Testing do the magic.