Home > Mobile > How-To: Show Features Only in Beta Builds

How-To: Show Features Only in Beta Builds

I was recently asked how to add a “Submit a Bug” feature to an app but only make it visible for Beta builds.

 

The code to actually send the bug was quite simple:

 

EmailComposeTask emailComposeTask = new EmailComposeTask();

emailComposeTask.Subject = "My App Feedback";

emailComposeTask.To = "feedback@mydomain.com";

emailComposeTask.Show();

 

Now the question is where to put it. Obviously this could be triggered from a button click, a menu item, or any other control on the screen. But if we only want the item to show up on beta builds we have some extra work to do.

One of the ways I like to deal with this is by adding a new configuration to the Configuration Manager.

In Visual Studio click the Configuration drop-down and choose ‘Configuration Manager’.

clip_image001

In Configuration Manager, choose to create a new configuration.

clip_image002

Call the configuration ‘Beta’ and choose to copy settings from Release.

clip_image003

Click OK to close the dialog.

Make sure ‘Beta’ is selected in the configuration drop-down.

Right click on the project and choose ‘Properties’.

image

Switch to the ‘Build’ tab.

Add a new conditional compile symbol called BETA.

clip_image004

Close the project properties window and make sure you saved your changes.

Now, anywhere in the code you can use BETA as a conditional compile statement.

 

#if BETA

contactButton.Visibility = Visibility.Visible;

#endif

 

Now you can easily switch between Debug, Release and Beta builds using the configuration drop-down at the top in Visual Studio!

About these ads
Categories: Mobile Tags: ,
You must be logged in to post a comment.
%d bloggers like this: