'Use "Runtime Variables" in a mobile application context

Currently, when I develop my application and I want to share it with my team or testers, I build my application using a development environment. So in the end, I have an .aab and .ipa that use a dev api url and different third party services with development tokens. Then, when I'm ready to release my app, I build my app with a production environment, and upload that build to the Apple and Google production tracks.

However, what I don't like about this solution is that you always have to "be careful".

I know that when we develop on a server, it is possible to have "variable runtimes" which makes that I can have only 1 "final code" but depending on the server on which it runs, it does not use the same urls, token of third parties, ... . This ensures that on the production server, it is absolutely impossible to have a version that uses development services/bdd.

Is there anything similar with mobile application development? It would be amazing if there was a trick to make only one IPA or AAB and define that if this IPA is in production track, in this case, it will use such API_URL.

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source