Category Archives: Software

Using OAuth2 with Microsoft OneDrive and Xamarin.Auth

Last week I had an interesting question about Xamarin.Auth, a library that allows Xamarin apps to authenticate users via standard authentication mechanisms (OAuth2), and store user credentials.

You can see how I wrote the word “standard” in bold because as long as some OAuth2 service follows the standards, Xamarin.Auth should support it. So my answer to whether Xamarin.Auth will work with OneDrive’s OAuth mechanisms was clearly “of course, it does”.

I was wrong.

Adding async/await to CocosSharp actions

UPDATE: The CocosSharp team has decided to integrate my ideas directly into their source! 🙂

Are you a C# programmer? Using Xamarin? Are you interested in making great games that run…

  • cross platform,
  • from one code base
  • and are powered by Cocos2D and XNA?

If yes, then you should check out CocosSharp!

I used Cocos2D in the past (the “good” old days of ObjectiveC…) and liked it a lot. Seeing all this translated to C# just freaks me out! 🙂

However there has been one thing that bugged me: chaining actions and running actions simultaneously.

Say, you want your character to scale, then increase some score counter, afterwards make the character jump and then reset the animation phase to the default frame. You would use something like:

[code]
var scale = new CCScaleBy (1f, 1.5f);
var jump = new CCJumpBy (1f, new CCPoint (100, 100), 50, 2);

this.RunActions (scale, new CCCallFunc (() => this.UpdateScore ()), jump, new CCCallFunc(() => this.SpriteFrame = this.defaultFrame));[/code]

Works, but with the power of C# we can do better!

My iOS8 adventure as a Xamarin developer

With this post I sum up my experiences with iOS8 as a developer. If possible I will provide solutions and workarounds.

The release of iOS8 is really unfortunate for me. A lot of my demos have stopped working and it seems like there are some really annoying bugs in iOS8.

Update: Added working example for reachability

Update: Apple confirms bug in iOS8 Simulator regarding backgrounding.

Update: explanation for the NSUrlSession issue found!

iOS8 is draining your iPhone’s battery? Maybe here’s why.

If you like me are an early adoptor of iOS8 – be it because you’re just or curious about the new feature, or did it for work – you might have noticed that your device’s battery life might have decreased a lot. Yesterday I talked to some developer-friends and they told me: “You know what’s cool, iOS8 keeps on running threads even if applications have been backgrounded!” I was baffled.

UPDATE: This post has been moved and is now part of http://krumelur.me/2014/09/23/my-ios8-advent…arin-developer/ ‎

Android – handling screen rotation and different layouts using Fragments with Xamarin

When I was asked if I could demo how to handle different screen sizes and rotation in Android, I created a small project which I’d like to share here. You can find the complete repo at Github.

The demo uses Xamarin.Android and was built using the Compatibility Lib v4 to support Android’s navigation drawer layout. Fragments are used directly and not via the compatibility packages.

Navigation Drawer on a Nexus 7

Navigation Drawer on a Nexus 7

Change language in Google’s Developer console

If you are (like me) located in Germany but prefer to use the Google Developer Console in English, I encourage you to navigate to https://play.google.com/apps/publish/ now and then try to change your language settings. I’m waiting here…

You’re back? What do you mean, it’s not possible? Turns out you’re almost right. I talked to Google support and indeed there is nothing in the UI that would allow you to switch the language. However there’s a workaround. Just append “&hl=en” to the URL and you’re set!

 https://play.google.com/apps/publish?hl=en

Making UITextView’s size exactly fit its content on iOS7

Sometimes you might want to add a UITextView as a subview to your layout, give it a specific width, assign some textual content to it and then make the text view exactly so high that it won’t scroll.

Back in the good old days of iOS6 one would just set the Frame size to the ContentSize of the UITextView. Done. But this does not work any longer on iOS7.

Making UITextView’s size exactly fit its content on iOS7

Sometimes you might want to add a UITextView as a subview to your layout, give it a specific width, assign some textual content to it and then make the text view exactly so high that it won’t scroll.

Back in the good old days of iOS6 one would just set the Frame size to the ContentSize of the UITextView. Done. But this does not work any longer on iOS7.

Management of iOS provisioning profiles with Xamarin

Recently I ran into some problems with iOS provisioning profiles while using Visual Studio for Xamarin. Some profiles wouldn’t show up and in the end I got super confused and started to wonder:

  • I’m inside Visual Studio here on a Windows machine and it shows me a list of profiles. Where do they come from?
  • There is Xamarin Studio on the Mac (the build host) and it also has a list of profiles. In addition it allows me to log in to my Apple developer account.
  • And we have Xcode. Guess what: provisioning profiles there, too and also a login dialog.

In the good old days, everything related to profiles was managed in the Xcode Organizer. Then Apple decided to strip Organizer down to the bare minimum and include everything into Xcode’s preferences.

Post has been updated because of changes in Xamarin Studio