I use two different build schemes for managing live and staging environments in my enterprise app. Both schemes use different app ids. Now, I want to integrate AppCenter analytics. I want to know, how can i manage two separate environments for same app, since I don’t want staging analytics to corrupt the live one.
Do I need to create a separate app in AppCenter for live and staging and use the corresponding app-secret to start analytics services depending on the selected build scheme? Or is there a better way?
I think you already answer your question since you said "I don’t want staging analytics to corrupt the live one" :). So I recommend to separate as Prod and Debug app.
In my app, I separate them by setting pragma PROD & DEBUG in Build Settings:
active compilation conditions:
DEBUG - Add pragma DEBUG
Release - Add pragma PROD
Then you can set your AppCenter secret key by using the code:
#if DEBUG
secretKey = "YOUR_DEBUG_KEY"
#else
secretKey = "YOUR_PROD_KEY"
#endif
Hope this helps.