Category Archives: Application development

Android Keystore file and password in VSTS builds

I was on site with a client last week working with them on DevOps for Xamarin.Forms builds using VSTS. The question came up of what to do about the Android Keystore file and its password – where to put them, keep them safe, etc.

Keystore file
If you’re running the build agent on a local build server (or Azure VM), the keystore file can be placed in a secure location on the build server. If you’re using the hosted build controller the Keystore file could be put into source control with limited access given to that file.

Keystore file password
For the Keystore file password, create a private variable in the Android build definition . Once the variable is set it cannot be displayed again. Then set the permissions in VSTS so only those who have Build Edit permissions can change this variable, and restrict who you give those permissions to accordingly.

clip_image001
The build step with a reference to the Keystore file in VSTS source control and a variable for the password.

image
The Keystore password saved as a Variable in the build definition.

Then you’ll need to set the security on the Build itself to limit who is allowed to edit the build definition.

image

image

And that’s it. Setting up the VSTS build in this way will keep the Keystore file and password safe in your Xamarin Android build definitions.

Enjoy!
–bliz

Universal Windows Platform app development resources

A client recently (as in a couple of minutes ago) asked me about resources for building apps on the Universal Windows Platform. For your reading pleasure, here’s the list I quickly compiled (thank you BING):

Overview: https://msdn.microsoft.com/app-development-msdn#universal

Windows Dev Center: https://dev.windows.com/en-us/

Get started with Windows apps: https://dev.windows.com/en-us/getstarted

UWP platform guide: https://msdn.microsoft.com/library/windows/apps/dn894631.aspx

Microsoft Virtual Academy free training on mobile development: http://www.microsoftvirtualacademy.com/training-topics/mobile-app-development

UWP code samples: https://dev.windows.com/en-us/samples

Dev Center developer programs: https://dev.windows.com/en-us/programs

How-to guides for Windows 10 apps: https://msdn.microsoft.com/library/windows/apps/xaml/mt244352.aspx

Move from iOS to UWP: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/mt238320.aspx

Enjoy!
–bliz

Identifier field in Xamarin iOS app project properties

I’ve been working with Xamarin.iOS for Visual Studio for a while now, and I’ve always wondered what the “Identifier” field really does. I heard something about using reverse domain name naming convention, but didn’t know why. Not having an iOS device, I’ve always tested on the iOS simulator, and I’d make up some random Identifier, such as “com.foo.bar”. The simulator didn’t complain, so I carried on in ignorance.

(Even though I simply made up an Identifier, while working in VS 2012 with Xamarin.iOS I quickly learned to always populate that field, plus the Application name and Version fields. If they’re empty when you send the app to the simulator, the simulator will barf all over you. Then you’ll have to dig around in Finder to weed out the bad app from the simulator folder structure. Ick. Nice recent update with Xamarin.iOS — it now will give a compiler error if those fields are empty when you build. Thanks, Xamarin!)

I found out this evening while digging around that the Identifier field is important when you want to test your app on a physical device, or want to publish the app to the App Store.

To use a physical device or publish to the App Store, you have to register an app profile in the Apple Developer site and download / install the profile on the Mac that has the Xamarin Build Host and Xcode. There are 2 ways to go when creating an app profile – one is explicit, defining the app name you’re going to use; the other is “wildcard” which allows you to use a single app ID to match multiple apps.

I create lots of demo apps, so I chose to go with a wildcard app id. That way I don’t have to create a new profile for each and every app I want to demo on a device. I created the app ID using the domain I own, as “com.snowstormlife.*” which allows me to use “com.snowstormlife” followed by any app name I want to give an app.

iOS Identifier property

The Xamarin site has a pretty good set of instructions about all this here: http://docs.xamarin.com/guides/ios/getting_started/device_provisioning/

Note that if you’re simply going to use the simulator instead of a device, it doesn’t really matter what you use in the Identifier property. It’s only important when you’re sending to the physical world or the app store.

Happy cross-platform coding,

-bliz

Porting a simple Silverlight game loop to Windows Phone 8

We’re going to have a Game Hackathon tomorrow at the Microsoft Office here in Tampa. For a little diversion, during this Hackathon I’m going to create a little Windows Phone 8 game. All I need is a game loop sample to get me started.

I thought about it for a second tonight, and it hit me: why not port the Silverlight game loop program I’ve been playing with over to the phone. It should be a snap! (https://jimblizzard.wordpress.com/2012/08/29/silverlight-game-loop-revisited-for-windows-8-and-visual-studio-2012-rtm/)

SilverlightGameLoopWindowsPhone8

Here are the steps I took:

I downloaded my Windows 8 Store app version of the source code from TFService and opened it in Visual Studio 2012. (If you haven’t tried TFService yet, you’ve gotta give it a try. Take a look at http://tfs.visualstudio.com/.)

In another copy of Visual Studio I created a new Windows Phone App project.

Images

I copied the scene.jpg and snowflake.png files from the Windows 8 project into the phone project’s Assets folder.

MainPage.xaml and MainPage.xaml.cs

I copied the XAML from MainPage.xaml in the Windows 8 app to MainPage.xaml in the Windows Phone app, starting and ending with the <Canvas></Canvas> tags.

Since the screen sizes are a bit different between Windows 8 and Windows Phone, I adjusted the location of the image to put the lighted tree in the frame. And I moved the controls for Total Snowflakes, Volume, and Wind into the viewing area.

For the code behind file, I simply copied the contents from the Windows 8 app beginning with the List<Snowflake> line to the closing brace for the class.

I added using statements for System.Windows.Media and System.Windows.Media.Animation.

Then I changed both of the RangeBaseValueChangedEventArgs to RoutedPropertyChangedEventArgs<double>

Snowflake.xaml and Snowflake.xaml.cs

I added a new user control, calling it Snowflake.xaml, then copied the XAML starting and ending with the <Image></Image> tags.

For the code behind file, I simply copied the contents from the Windows 8 app beginning with double _posLeft = 0.0; line to the closing brace for the class. I didn’t have to make any other code changes in that file.

 

That’s all I had to do. And if you’re copying from the original Silverlight sample code, you probably won’t even have to do that much.

It was super easy and took less than five minutes. Good times. Bring on the Hackathon!