Artisanal Cross Platform Data Persistence – A SQLite & SQLite.Net Primer

Artisanal Cross Platform Data Persistence – A SQLite & SQLite.Net Primer

Hola and bon jour – my name is Rueben and I painstakingly handcraft local artisanal custom software. Hi – my name is Matt and I’m going to translate Rueben’s hipster speak into normal English. He means when you hire him to create an app, he camps out in your backyard and takes a long time to finish. The apps I create are true to the spirit of the device on which they run. A minimalistic design ensures nothing interferes in the experience between you and the phone. They’re designed to allow you to feel the electrons flow under your fingers. The apps are black and white and ugly. The data storage is stripped down to just the essential working parts – a simple CSV text file … Wait… what?!? You’re saving your user’s data in just a CSV file? Why would you do that? Well, I learned it from you! I was following along with your previous blog posts and you did it there! And while we’re at it, the UI of all your apps are black and white and rectangular too! And I know you ride your bike & I see you at the farmer’s market, don’t pretend you don’t try to be a hipster! Ah… umm… well… let’s talk about data access now, shall we? Cross Platform Storage Options Alright… there are a couple of different ways we can store data on the device. Of course, we could just use the file system and store all data in CSV files. That’s what I’m talking about! But believe it or not there are other… and sometimes depending on...
Cross Platform Preprocessor Directive Blues – Or Finding Cheer With Shared Projects

Cross Platform Preprocessor Directive Blues – Or Finding Cheer With Shared Projects

(Ba ba… ba bump) From the day I was born (Ba ba… ba bump) I was writing cross platform apps utilizing Shared Projects code (Ba ba… ba bump) Then I started adding platform specific features (Ba ba… ba bump) And my code became a mess of hash codes and everything got lost… (Ba ba… ba bump) I’ve got the cross platform preprocessor directive blues!!! Am I the only one who sings the blues when dealing with shared projects and all the preprocessor directives they bring? Shared projects are a great way to share a single code base across platforms, but start to introduce a lot of platform specific functionality into them – and watch out! Preprocessor Directive Blues! Using shared projects doesn’t necessarily mean we will end up with a mess of hash signs and #if statements and generally an un-followable mis-mash of code – there are techniques we can use to refactor away the preprocessor directives, pull ourselves out of the blues and find some cheer with shared projects! Shared Projects Recap Before we let the sunshine in, let’s recap a bit on why I’d even consider using shared projects in the first place if they have the potential to cause me to sing the blues! Shared projects are a way to share a single code base across platforms (in our case – iOS, Android, Windows Phone) all within the same solution. The same code. The same functionality. Different platforms. Shared projects also provide full access to the .Net Framework, unlike another means to achieve cross platform code reuse – PCLs. (Plus a dirty secret that people don’t...
Climbing Gumdrop Mountain – Or How To Create Xamarin Android Bindings

Climbing Gumdrop Mountain – Or How To Create Xamarin Android Bindings

Remember way, way back into the distant past (yeah, it’s been a while since I posted) to the Stranger In A Strange Land post about Xamarin iOS bindings? And how strange Objective-C is, at least to a C# developer trying to bind an Objective-C library for use in a Xamarin project? Now imagine you leave the friendly confines of iOS and venture into a land where the air smells sugary sweet and the locals speak a language that you can kind of understand – just tinged with a weird local dialect (hey… kind of like Northern Wisconsin), but the way they go about daily life is … well … different. All the cities in this land named after candy! KitKat, Lollipop, and (mmmm…) Jelly Bean! But some of these candy cities are very, very old and don’t have the amenities of the newer ones. So we have to be careful how we develop so as to not leave anybody out. This land offers a million ways to do anything – some are as satisfying as floating in down a chocolate river. Others can be as painful as having little orange fellows with green hair shove you down a garbage shoot! Welcome to the land of Java and Android, the Willy Wonka world of mobile development. In this post we’re going to explore how to take an Android library and bind it to C# for use in a Xamarin Android project. And as a real treat, creating the actual binding from Java to C# can be much easier than it is with Objective-C. Of course, you have to watch out...